remove compiler warnings of new compilerversion /
[owTools.git] / src / main.cpp
index c4e223d..51fd6c0 100644 (file)
@@ -129,6 +129,7 @@ printf("            [database]\n");
 printf("            [prefix] -> a prefix of all tables \n\n");
 printf("      -r Search every time for new Devices\n");
 printf("      -t [text_file] append comma separadet to text-file\n");
+printf("      -j Use 0xCC 0x44 to send convert temperature to all DS18B20 and DS2438\n");
 printf("   -f [hexfile]    flash new\n");
 printf("   -n [\"id as 64bit Hex\"] change id   \n");
 printf("               example: -n \"5D02160084D9A220\" \n");
@@ -318,11 +319,13 @@ void continuous(std::vector<owDevice*> *devices,int intervall,int headline,int s
 
                for (owDevice* dev :*devices) {
                        for(int k=0;k<owi->maxrepeat;k++){
-                               //std::vector<uint8_t> data;
-                               //data.push_back(0xCC);
-                               //data.push_back(0x44);
-                               //owi->Reset();
-                               //owi->Communicate(&data, 2, 0);
+                               if (owCC_44_Temp>0) {
+                                       std::vector<uint8_t> data;
+                                       data.push_back(0xCC);
+                                       data.push_back(0x44);
+                                       owi->Reset();
+                                       owi->Communicate(&data, 2, 0);
+                               }
                                dev->convertAll();
                                if (owi->log->last()<OWLOG_ERROR) break;
                                owi->log->clear();
@@ -610,6 +613,10 @@ int main(int argc, char *argv[]) {
                interactive(owi);       
        } else 
        if (getArg("c")=="1") {
+               if (getArg("j")=="1") {
+                       printf("Use 1-Wire command 0xCC 0x44 to send convert temperature to all DS18B20 and DS2438\n");
+                       owCC_44_Temp=1;
+               }
                int reload=(getArg("r")=="1");
                owi->Find();
                printf("\n");
@@ -829,8 +836,12 @@ int main(int argc, char *argv[]) {
                        } else {
                                unsigned long long l=strtoull(s.c_str(),NULL,16);
                                if ((snum.num&0xFF)!=(l&0xFF)) {
-                                       printf("ERROR: Family of Device 0x%02X->0x%02X can not be changed\n",(int)(snum.num&0xFF),(int)(l&0xFF));
-                                       exit(1);
+                                         printf("This command change family-fode of Device 0x%02X->0x%02X\n",(int)(snum.num&0xFF),(int)(l&0xFF));
+                                        int resetid=questionYesNo("Are you sure?");
+                                        if (resetid==0) {
+                                          printf("ERROR: Family of Device 0x%02X->0x%02X can not be changed\n",(int)(snum.num&0xFF),(int)(l&0xFF));
+                                          exit(1);
+                                        }
                                }
                                snum.num=l;
                                //printf("->%016llX\n",(unsigned long long)l);