on7lds / NextionDriver

Driver program to connect MMDVMhost with Nextion Displays, adding extra functionality
33 stars 33 forks source link

Improper/missing status codes being sent for select basic functions #33

Open kn2tod opened 1 month ago

kn2tod commented 1 month ago

Improper status codes are being sent to the display for two select fields: t8 and t9, causing havoc for any screens using these fields.

1436 │ Jun 2 14:17:29 pi-star-test NextionDriver: NET: t9.txt="World-wide" 1437 │ Jun 2 14:17:29 pi-star-test NextionDriver: LH: check [t9.txt="World-wide"] on page 2 1438 │ Jun 2 14:17:29 pi-star-test NextionDriver: LH: page 2 field 9 is [txt="World-wide"] 1439 │ Jun 2 14:17:29 pi-star-test NextionDriver: LH: statusval 0 <----- 62? 1440 │ Jun 2 14:17:29 pi-star-test NextionDriver: NET: t9.txt="World-wide" 1441 │ Jun 2 14:17:29 pi-star-test NextionDriver: LH: check [t9.txt="World-wide"] on page 2 1442 │ Jun 2 14:17:29 pi-star-test NextionDriver: LH: page 2 field 9 is [txt="World-wide"] 1443 │ Jun 2 14:17:29 pi-star-test NextionDriver: LH: statusval 0 <----- 62? 1444 │ Jun 2 14:17:29 pi-star-test NextionDriver: RX: MMDVM.status.val=65 1445 │ Jun 2 14:17:29 pi-star-test NextionDriver: NET: MMDVM.status.val=65 1446 │ Jun 2 14:17:29 pi-star-test NextionDriver: LH: check [MMDVM.status.val=65] on page 2 1447 │ Jun 2 14:17:30 pi-star-test NextionDriver: RX: click S0,1 1448 │ Jun 2 14:17:30 pi-star-test NextionDriver: NET: click S0,1 1449 │ Jun 2 14:17:30 pi-star-test NextionDriver: LH: check [click S0,1] on page 2 1450 │ Jun 2 14:17:30 pi-star-test NextionDriver: Received 90 bytes from host 1451 │ Jun 2 14:17:30 pi-star-test NextionDriver: RX: t8.txt="N TA3AUP" 1452 │ Jun 2 14:17:30 pi-star-test NextionDriver: NET: t8.txt="N TA3AUP" 1453 │ Jun 2 14:17:30 pi-star-test NextionDriver: LH: check [t8.txt="N TA3AUP"] on page 2 1454 │ Jun 2 14:17:30 pi-star-test NextionDriver: LH: page 2 field 8 is [txt="N TA3AUP"] 1455 │ Jun 2 14:17:30 pi-star-test NextionDriver: LH: statusval 65 <------ 70! 1456 │ Jun 2 14:17:30 pi-star-test NextionDriver: RX: MMDVM.status.val=63 1457 │ Jun 2 14:17:30 pi-star-test NextionDriver: NET: MMDVM.status.val=63 1458 │ Jun 2 14:17:30 pi-star-test NextionDriver: LH: check [MMDVM.status.val=63] on page 2 1459 │ Jun 2 14:17:30 pi-star-test NextionDriver: RX: click S0,1 1460 │ Jun 2 14:17:30 pi-star-test NextionDriver: NET: click S0,1

The usual sendcommand for the current txbuffer needs to be followed up with two sencommand's for the status value associated with each field:

//send TG name if found (Slot 1) if ((page==2)&&(strstr(TXbuffer,"t1.txt")!=NULL)&&(TXbuffer[8]!='"')) { char TGname; int nr,TGindex; sendCommand(TXbuffer); if ((TXbuffer[8]>='0')&&(TXbuffer[8]<='9')) nr=atoi(&TXbuffer[8]); else nr=atoi(&TXbuffer[10]); TGindex=search_group(nr,groups,0,nmbr_groups-1); writelog(LOG_INFO,"Search group %d (index %d)",nr,TGindex); if (TGindex>=0) { TGname=groups[TGindex].name; writelog(LOG_INFO,"Found %s",TGname); sprintf(TXbuffer,"t9.txt=\"%s\"",TGname); } else if (TGindex<0) { //is it maybe a user private call ? TGindex=search_user_index_for_ID(nr,users,0,nmbr_users-1); writelog(LOG_INFO,"- Found [%s] for ID %d",users[TGindex].data1,nr); if (TGindex>=0) sprintf(TXbuffer,"t9.txt=\"Private %s\"",users[TGindex].data1); } else { sprintf(TXbuffer,"t9.txt=\"TG%d name not found\"",nr); } sendCommand(TXbuffer); sprintf(text, "MMDVM.status.val=62"); <---- sendCommand(text); <---- sendCommand("click S0,1"); <---- } //send TG name if found (Slot 2) if ((page==2)&&(strstr(TXbuffer,"t3.txt")!=NULL)&&(TXbuffer[8]!='"')) { char TGname; int nr,TGindex; sendCommand(TXbuffer); if ((TXbuffer[8]>='0')&&(TXbuffer[8]<='9')) nr=atoi(&TXbuffer[8]); else nr=atoi(&TXbuffer[10]); TGindex=search_group(nr,groups,0,nmbr_groups-1); writelog(LOG_INFO,"Search group %d (index %d)",nr,TGindex); if (TGindex>=0) { TGname=groups[TGindex].name; writelog(LOG_INFO,"Found %s",TGname); sprintf(TXbuffer,"t8.txt=\"%s\"",TGname); } else if (TGindex<0) { //is it maybe a user private call ? TGindex=search_user_index_for_ID(nr,users,0,nmbr_users-1); writelog(LOG_INFO,"- Found [%s] for ID %d",users[TGindex].data1,nr); if (TGindex>=0) sprintf(TXbuffer,"t8.txt=\"Private %s\"",users[TGindex].data1); } else { sprintf(TXbuffer,"t8.txt=\"TG%d name not found\"",nr); } sendCommand(TXbuffer); sprintf(text, "MMDVM.status.val=70"); <---- sendCommand(text); <---- sendCommand("click S0,1"); <---- }