remove compiler warnings of new compilerversion /
[owTools.git] / src / main.cpp
index 838b99e..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,18 +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);
-=======
-                               std::vector<uint8_t> data;
-                               data.push_back(0xCC);
-                               data.push_back(0x44);
-                               owi->Reset();
-                               owi->Communicate(&data, 2, 0);
->>>>>>> origin/master
+                               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();
@@ -617,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");
@@ -645,15 +645,11 @@ int main(int argc, char *argv[]) {
                        database=1;
                }
 #endif
-<<<<<<< HEAD
                if      ((s=getArg("t")) !="")  {
                        textfile=1;
                        printf("Write values to textfile %s\n",s.c_str());
                        textfilename=s;
                }
-=======
-                       
->>>>>>> origin/master
                
                continuous(&(owi->devices),pause,1,reload);     
        } else 
@@ -728,11 +724,6 @@ int main(int argc, char *argv[]) {
        // --------------------- Memory functions
        //------------------------------------------------------------------------------------------
        
-=======
-       // --------------------- Memory functions
-       //------------------------------------------------------------------------------------------
-       
->>>>>>> origin/master
        if ((s=getArg("m"))!="") {
                int pnr=0;
                std::vector<uint8_t> mem;
@@ -821,11 +812,7 @@ int main(int argc, char *argv[]) {
                                                if (c=='x') br=1;
                                        } else {
                                                if ((c==',')|(c=='}')) {
-<<<<<<< HEAD
                                                        isnum.byte[i]=(uint8_t)strtoull(s, NULL, 16);
-=======
-                                                       isnum.byte[i]=(uint8_t)strtol(s, NULL, 16);
->>>>>>> origin/master
                                                        //printf("%x\n",strtol(s, NULL, 16));
                                                        i++;
                                                        br=0;
@@ -847,14 +834,14 @@ int main(int argc, char *argv[]) {
                        if (s=="1") {
                                snum.num+=256;
                        } else {
-<<<<<<< HEAD
                                unsigned long long l=strtoull(s.c_str(),NULL,16);
-=======
-                               unsigned long long l=strtol(s.c_str(),NULL,16);
->>>>>>> origin/master
                                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);