add max nrfreceivedelay to display

This commit is contained in:
interfisch 2022-06-19 20:10:31 +02:00
parent 85f200da22
commit 3a04a12713
1 changed files with 4 additions and 1 deletions

View File

@ -166,6 +166,7 @@ nrfdata lastnrfdata;
long last_nrfreceive = 0; //last time values were received and checksum ok long last_nrfreceive = 0; //last time values were received and checksum ok
unsigned long nrf_delay = 0; unsigned long nrf_delay = 0;
unsigned long last_nrfreceive_delay=0; unsigned long last_nrfreceive_delay=0;
unsigned long max_last_nrfreceive_delay=0; //maximum value (used for display)
#define MAX_NRFDELAY 100 //ms. maximum time delay at which vehicle will disarm #define MAX_NRFDELAY 100 //ms. maximum time delay at which vehicle will disarm
boolean radiosendOk=false; boolean radiosendOk=false;
@ -441,6 +442,7 @@ void loop() {
if (lastnrfdata.checksum == calcchecksum) { //checksum ok? if (lastnrfdata.checksum == calcchecksum) { //checksum ok?
lastpacketOK = true; lastpacketOK = true;
last_nrfreceive_delay=loopmillis-last_nrfreceive; //for display purpose last_nrfreceive_delay=loopmillis-last_nrfreceive; //for display purpose
max_last_nrfreceive_delay=max(last_nrfreceive_delay,max_last_nrfreceive_delay);
last_nrfreceive = loopmillis; last_nrfreceive = loopmillis;
watchdogtimer=loopmillis; //reset watchdog watchdogtimer=loopmillis; //reset watchdog
@ -670,6 +672,7 @@ void updateInputs(unsigned long loopmillis) {
} }
if (button_down_click) { if (button_down_click) {
displaymode=DISPLAY_STATS3; displaymode=DISPLAY_STATS3;
max_last_nrfreceive_delay=0; //reset when switching to this display
} }
break; break;
case DISPLAY_MENU: case DISPLAY_MENU:
@ -876,7 +879,7 @@ void display_show_stats3() {
display.print(F("looptime=")); display.println(loopmillis-last_loopmillis); display.print(F("looptime=")); display.println(loopmillis-last_loopmillis);
display.print(F("feedback=")); display.println(esc.getFeedbackInterval()); display.print(F("feedback=")); display.println(esc.getFeedbackInterval());
display.print(F("nrf_delay=")); display.println(last_nrfreceive_delay); display.print(F("nrf_delay=")); display.println(last_nrfreceive_delay); display.print(F(" max=")); display.println(max_last_nrfreceive_delay);
display.print(F("maxdiff=")); display.println(raw_length_maxdiff); display.print(F("maxdiff=")); display.println(raw_length_maxdiff);