Browse Source

More code

Per Mårtensson 1 year ago
parent
commit
5077312146
4 changed files with 275 additions and 535 deletions
  1. 10 0
      sw/DC_LOAD/include/config.h
  2. 0 10
      sw/DC_LOAD/include/screen.h
  3. 265 319
      sw/DC_LOAD/src/main.cpp
  4. 0 206
      sw/DC_LOAD/src/screen.cpp

+ 10 - 0
sw/DC_LOAD/include/config.h

@@ -10,4 +10,14 @@
 #define col_red                 63488
 #define col_green               1024
 #define col_gray                50712
+#define col_blue                1055
+#define  line_len               21
+#define MODE_CC                 1
+#define MODE_CP                 2
+#define MODE_CR                 3
+#define MODE_TC                 4
+#define MODE_TP                 5
+#define MODE_TT                 6
+#define MODE_TL                 7
+#define MODE_BC                 8
 #endif // DCLOAD_CONFIG_H

+ 0 - 10
sw/DC_LOAD/include/screen.h

@@ -1,10 +0,0 @@
-#ifndef DCLOAD_SCREEN_H
-#define DCLOAD_SCREEN_H
-void screen_clear(char empty);
-void print_chars(int x1,int z, char * text,int len);
-void print_chars2(int x1,int len);
-void print_char(int x1,int z, char text);
-void print_line(int x1);
-void writeNum2(char *  command, uint16_t  txt);
-void setmode(void);
-#endif // DCLOAD_SCREEN_H

File diff suppressed because it is too large
+ 265 - 319
sw/DC_LOAD/src/main.cpp


+ 0 - 206
sw/DC_LOAD/src/screen.cpp

@@ -1,206 +0,0 @@
-#include <Arduino.h>
-#include "EasyNextionLibrary.h"
-#include <screen.h>
-#include <SoftwareSerial.h>
-#include <config.h>
-extern char line1[21];
-extern char line2[21];
-extern char line3[21];
-extern char line4[21];
-extern char line1_buf[21];
-extern char line2_buf[21];
-extern char line3_buf[21];
-extern char line4_buf[21];
-extern String Mode;
-extern String old_Mode;
-extern EasyNex myNex;
-
-extern SoftwareSerial nexSerial;
-void writeStr(char *  command, char * txt){ 
-	String _component = String(command);
-	String _strVal = String(txt);
-  if(_component == "cmd"){
-    nexSerial.print(_component);
-    nexSerial.print("\xFF\xFF\xFF");
-    
-  }else if(_component != "cmd"){
-    nexSerial.print(command);
-    nexSerial.print("=\"");
-    nexSerial.print(txt);
-
-    nexSerial.print("\"");
-    nexSerial.print("\xFF\xFF\xFF");
-  }
-}
-void writeNum2(char *  command, uint16_t txt){ 
-	String _component = String(command);
-	String _strVal = String(txt);
-  if(_component == "cmd"){
-    nexSerial.print(_component);
-    nexSerial.print("\xFF\xFF\xFF");
-    
-  }else if(_component != "cmd"){
-    nexSerial.print(command);
-    nexSerial.print("=");
-    nexSerial.print(txt);
-
-    nexSerial.print("\xFF\xFF\xFF");
-  }
-}
-void screen_clear(char empty){
-  memset(line1, empty, 20);
-  memset(line2, empty, 20);
-  memset(line3, empty, 20);
-  memset(line4, empty, 20);
-  writeStr("t0.txt",line1);
-  writeStr("t1.txt",line2);
-  writeStr("t2.txt",line3);
-  writeStr("t3.txt",line4);
-}
-
-void print_chars(int x1,int z, char * text,int len){
-      switch(x1){
-        case 0:
-          memcpy(line1+z,text,len);
-          if (memcmp(line1_buf,line1,20)!=0){
-            writeStr("t0.txt",(char *)line1);
-          }
-          memcpy(line1_buf,line1,20);
-          break;
-        case 1:
-
-          memcpy(line2+z,text,len);
-          if (memcmp(line2_buf,line2,20)){
-            writeStr("t1.txt",line2);
-          }
-          memcpy(line2_buf,line2,20);
-          break;
-        case 2:
-          
-          memcpy(line3+z,text,len);
-          if (memcmp(line3_buf,line3,20)!=0)
-            writeStr("t2.txt",line3);
-          memcpy(line3_buf,line3,20);
-          break;
-        case 3:
-          
-          memcpy(line4+z,text,len);
-          if (memcmp(line4_buf,line4,20)!=0)
-            writeStr("t3.txt",line4);
-          memcpy(line4_buf,line4,20); 
-          break;          
-
-      }
-}
-void print_chars2(int x1,int len){
-      switch(x1){
-        case 0:
-          line1[21]='\0';
-          if (memcmp(line1_buf,line1,20)!=0){
-            writeStr("t0.txt",(line1));
-          }
-          line1[21]='\0';
-          memcpy(line1_buf,line1,21);
-          
-          break;
-        case 1:
-          line2[20]='\0';
-          if (memcmp(line2_buf,line2,20)){
-            writeStr("t1.txt",(line2));
-          }
-          line2[20]='\0';
-          memcpy(line2_buf,line2,21);    
-          break;
-        case 2:
-          line3[20]='\0';
-          if (memcmp(line3_buf,line3,20)!=0)
-            writeStr("t2.txt",(line3));
-          line3[20]='\0';
-          memcpy(line3_buf,line3,21);
-          break;
-        case 3:
-          line4[20]='\0';
-          if (memcmp(line4_buf,line4,20)!=0)
-            writeStr("t3.txt",(line4));
-          line4[20]='\0';
-          memcpy(line4_buf,line4,21); 
-          break;          
-
-      }
-      Serial.flush();
-      Serial.flush();
-      delay(1);
-}
-void print_char(int x1,int z, char text){
-      switch(x1){
-        case 0:
-          
-          line1[z]=text;
-          if (memcmp(line1_buf,line1,20)!=0)
-            writeStr("t0.txt",(char *)line1);
-          memcpy(line1_buf,line1,20);   
-          break;
-        case 1:
-          
-          line2[z]=text;
-          if (memcmp(line2_buf,line2,20)!=0)
-            writeStr("t1.txt",line2);
-          memcpy(line2_buf,line2,20);  
-          break;
-        case 2:
-          
-          line3[z]=text;
-          if (memcmp(line3_buf,line3,20)!=0)  
-            writeStr("t2.txt",line3);
-          memcpy(line3_buf,line3,20);  
-          break;
-        case 3:
-          
-          line4[z]=text;
-          if (memcmp(line4_buf,line4,20)!=0)
-            writeStr("t3.txt",line4);
-          memcpy(line4_buf,line4,20);  
-          break;          
-
-      }
-}
-void setmode(){
-  if (Mode!=old_Mode){
-    if (Mode == "TC" || Mode == "TP" || Mode == "TT" || Mode == "TL" ) {
-          writeNum2("bi.bco",(int) col_gray);
-          writeNum2("bw.bco",(int) col_gray);
-          writeNum2("br.bco",(int) col_gray);  
-          writeNum2("bbat.bco",(int) col_gray); 
-          writeNum2("btrans.bco",(int) col_green);
-    }
-    if (Mode == "CC" ) {
-          writeNum2("bi.bco",(int) col_green);
-          writeNum2("bw.bco",(int) col_gray);
-          writeNum2("br.bco",(int) col_gray);  
-          writeNum2("bbat.bco",(int) col_gray); 
-          writeNum2("btrans.bco",(int) col_gray);
-    }
-    if (Mode == "CP" ) {
-          writeNum2("bi.bco",(int) col_gray);
-          writeNum2("bw.bco",(int) col_green);
-          writeNum2("br.bco",(int) col_gray);  
-          writeNum2("bbat.bco",(int) col_gray); 
-          writeNum2("btrans.bco",(int) col_gray);
-    }
-    if (Mode == "CR" ) {
-          writeNum2("bi.bco",(int) col_gray);
-          writeNum2("bw.bco",(int) col_gray);
-          writeNum2("br.bco",(int) col_green);  
-          writeNum2("bbat.bco",(int) col_gray); 
-          writeNum2("btrans.bco",(int) col_gray);
-    }
-    if (Mode == "BC" ) {
-          writeNum2("bi.bco",(int) col_gray);
-          writeNum2("bw.bco",(int) col_gray);
-          writeNum2("br.bco",(int) col_gray);  
-          writeNum2("bbat.bco",(int) col_green); 
-          writeNum2("btrans.bco",(int) col_gray);
-    }
-    Mode=old_Mode;
-  }
-}

Some files were not shown because too many files changed in this diff