|
@@ -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;
|
|
|
- }
|
|
|
-}
|