From 19984cf531fa8e7d4724aa563a8c1b1d35ee27a7 Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Sun, 19 Apr 2020 10:36:41 -0400 Subject: [PATCH] 2020.04.19.01 More work on FEATURE_NEXTION_DISPLAY, Nextion Display API (UNDER DEVELOPMENT) Documentation in progress: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display --- ... - BASE - NX4832TO35 - v2020.04.19.01.HMI} | Bin 1276763 -> 1278374 bytes .../k3ng_rotator_controller.ino | 122 +++++++++++++++++- 2 files changed, 119 insertions(+), 3 deletions(-) rename k3ng_rotator_controller/Nextion/{K3NG Rotator Controller - BASE - NX4832TO35 - v2020.04.18.01.HMI => K3NG Rotator Controller - BASE - NX4832TO35 - v2020.04.19.01.HMI} (96%) diff --git a/k3ng_rotator_controller/Nextion/K3NG Rotator Controller - BASE - NX4832TO35 - v2020.04.18.01.HMI b/k3ng_rotator_controller/Nextion/K3NG Rotator Controller - BASE - NX4832TO35 - v2020.04.19.01.HMI similarity index 96% rename from k3ng_rotator_controller/Nextion/K3NG Rotator Controller - BASE - NX4832TO35 - v2020.04.18.01.HMI rename to k3ng_rotator_controller/Nextion/K3NG Rotator Controller - BASE - NX4832TO35 - v2020.04.19.01.HMI index 06480501b083356af1a3efa26b753fc3d7bcb717..1adb61293f396223922f6dd33fecdce901de5cc3 100644 GIT binary patch delta 3509 zcmeHJYfMx}6rQ`h(UqOKfPhf16nqo}e5HzjAW*f%mWLuf@d{g9Sy;L(VAkjou(7Rz z8m!Zo^;fNp1RqteP2034rZ)Yd_D{7w(clvkP?Kt{Ej_b$hKn12)PHT#NrwHHbLPyP z@1F16d*QeFds<&Fi$X9|TW!kR`STdmhXrLz2uY{isK&>ZE$KD{Hgw93hIOt8NND=S zbQf^5$%0Nm0N9GQXY7rhl2WJgfZm@obr}5=3$Ww3BoF_n4WsK};Jt4}Ku4?;8;yM2 zO`RBBjsu5|B1y439aT=XCZ(PS-1Zkn$4y{7>qdn>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;l@h8E zn}UC&cPl#=y+;eflg zE2t~6>rY1J%_4;Er266uGq`mViZ>x&G?NLv)pp;8uaxtMr_ACcKL-=dlTI{~-s5sT zxP+67Dy|)@w$C1OWWiESIxEBTsC(|Qk2yJzhiOP==9sjVKXTGjWA07JtTAiO$93zD z=Gw+feXF(}R@x3L6kqdO#n*srNW_BJ^+yyxF6i}d8%>N$=9pk z|G`{o<0BB%xf}Z05rzDSYL4&`I>BHk8KsbXf~7%sfE!NDbLLaCZ%wUS5OAYb{Rm@P zbt1oWg5wI*;X8q!m_W!I0$)VFF+Hy!-&z zC$5HshcKA zuk}e`nlfd4bC$%d)A8TLMy>b6;cTfzn>iCjPCLpL^VYUp8Slu$n{~kOTkJvO%h&j- zM0&qb0{prMj;r66Ns71Ip*?7_cS3v=w39KrmG+xfYUP)y20_OEGQRQXH*8RQ zkmu69z^<@VW6MW8OEJ3<*la!xf{m;UwBK2d;m* z2`;iG&I;>tqb(9w`rDTtQ2JV!naK;3M9H}Uf*mXyYC>!Z47cd{%6Jc)-p5j)xKVe& z-4VV!6Pf=*m71*DHJQZ&EK@n;_wge%32H+u2uprJN0r4(fvI&Mu}H1 zrY#=|jf*PeNP29c)Oh|=Qu~FAWW4%miI**w-L`B=9IljIRaYhP^6Fcir;?RRqk0!- z=p*HHj4-?4LZe;;_LuY`qk6smCWVJJUG(6@_#RBysC(elE9@%0E9yB&-h?i+IxyYp uKybZi2F&TcAPtc<-M!K2PNzb-j=vdi2lxlh=DJAfop~s$^`FhdD#zcu?`M+$ diff --git a/k3ng_rotator_controller/k3ng_rotator_controller.ino b/k3ng_rotator_controller/k3ng_rotator_controller.ino index 7321b19..1e2b0a6 100644 --- a/k3ng_rotator_controller/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller/k3ng_rotator_controller.ino @@ -451,6 +451,10 @@ More work on FEATURE_NEXTION_DISPLAY, Nextion Display API (UNDER DEVELOPMENT) Documentation in progress: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display + 2020.04.19.01 + More work on FEATURE_NEXTION_DISPLAY, Nextion Display API (UNDER DEVELOPMENT) + Documentation in progress: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display + All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc. Anything rotator_*.* should be in the ino directory! @@ -460,7 +464,7 @@ */ -#define CODE_VERSION "2020.04.18.01" +#define CODE_VERSION "2020.04.19.01" #include #include @@ -4241,6 +4245,7 @@ void service_nextion_display(){ static int last_azimuth = 0; static unsigned long last_az_update = 0; static unsigned long last_various_things_update = 0; + static unsigned long last_statuses_update = 0; int temp = 0; char *buffer; uint16_t len; @@ -4290,8 +4295,7 @@ void service_nextion_display(){ static unsigned long last_status3_update = 0; #endif -//zzzzzz - + #define NEXTION_VERY_FREQUENT_UPDATE_MS 250 #define NEXTION_FREQUENT_UPDATE_MS 500 #define NEXTION_LESS_FREQUENT_UPDATE_MS 1000 @@ -4354,6 +4358,98 @@ void service_nextion_display(){ last_serial_receive_time = 0; } + + // Update Statuses + if ((millis() - last_statuses_update) > NEXTION_VERY_FREQUENT_UPDATE_MS){ + + // gADS - Azimuth Detailed State + dtostrf(az_state, 1, 0, workstring1); + strcpy(workstring2,"gADS="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + + // gEDS - Elevation Detailed State + dtostrf(el_state, 1, 0, workstring1); + strcpy(workstring2,"gEDS="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + + // gAOS - Azimuth Overall State + dtostrf((int)current_az_state, 1, 0, workstring1); + strcpy(workstring2,"gAOS="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + + // gEOS - Elevation Overall State + dtostrf((int)current_el_state, 1, 0, workstring1); + strcpy(workstring2,"gEOS="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + + // gCS - Clock State + #if defined(FEATURE_CLOCK) + dtostrf((int)clock_status, 1, 0, workstring1); + strcpy(workstring2,"gCS="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + #endif + + // gVS - Various States + temp = 0; + if (brake_az_engaged){ + temp = temp | 1; + } + if (brake_el_engaged){ + temp = temp | 2; + } + + switch(az_request_queue_state){ + case IN_QUEUE: + temp = temp | 4; + break; + case IN_PROGRESS_TIMED: + temp = temp | 8; + break; + case IN_PROGRESS_TO_TARGET: + temp = temp | 16; + break; + } + + switch(el_request_queue_state){ + case IN_QUEUE: + temp = temp | 32; + break; + case IN_PROGRESS_TIMED: + temp = temp | 64; + break; + case IN_PROGRESS_TO_TARGET: + temp = temp | 128; + break; + } + + +//zzzzzz +// TODO +// #define NOT_PARKED 0 +// #define PARK_INITIATED 1 +// #define PARKED 2 + +// #define AUTOCORRECT_INACTIVE 0 +// #define AUTOCORRECT_WAITING_AZ 1 +// #define AUTOCORRECT_WAITING_EL 2 +// #define AUTOCORRECT_WATCHING_AZ 3 +// #define AUTOCORRECT_WATCHING_EL 4 + + dtostrf((int)temp, 1, 0, workstring1); + strcpy(workstring2,"gVS="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + + last_statuses_update = millis(); + } + + + // Update various things if ((millis() - last_various_things_update) > NEXTION_LESS_FREQUENT_UPDATE_MS){ // Rotator Controller API Implementation Version @@ -4407,6 +4503,7 @@ void service_nextion_display(){ // Azimuth if (((azimuth != last_azimuth) || ((millis() - last_az_update) > NEXTION_FREQUENT_UPDATE_MS))){ + // zAz dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring1); //strcat(workstring1,"\xF8"/*DISPLAY_DEGREES_STRING*/); // haven't figured out how the hell to get degrees symbol to display strcpy(workstring2,"vAz.txt=\""); @@ -4417,6 +4514,19 @@ void service_nextion_display(){ debug.println(workstring2); #endif sendNextionCommand(workstring2); + + // gAz + dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, 0, workstring1); + strcpy(workstring2,"gAz="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + + // gAzR + dtostrf(raw_azimuth / LCD_HEADING_MULTIPLIER, 1, 0, workstring1); + strcpy(workstring2,"gAz="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + last_azimuth = azimuth; last_az_update = millis(); @@ -4443,6 +4553,12 @@ void service_nextion_display(){ strcat(workstring2,"\""); sendNextionCommand(workstring2); + // gEl + dtostrf(elevation / LCD_HEADING_MULTIPLIER, 1, 0, workstring1); + strcpy(workstring2,"gEl="); + strcat(workstring2,workstring1); + sendNextionCommand(workstring2); + last_elevation = elevation; last_el_update = millis(); }