- New Message indicator:
  - "private message" is now "m"
  - "winlink" is now "w"
  - Both: "M"
  - M / m is now cleared if you read your message on display (see below)

- message ((MSG)):
  - changed date notation to mm-dd
  - fixed small bug in displaying the time
  - If you enter this menu item, new message-indicaor is cleared

- middle button: if webserver is started
  - changed info text for display to make it more clear, that you now
    should release the button (to avoid factory reset on boot)
  - changed time to tread this from 2s to 3s

- tnc:
  - fixed a bug when starting webserver via tnc cli
  - beauty: added blank for displaying debug level

- display: in behind_position_tx, fillDisplayLine1(5) is not needed;
  we test this and commented it out.

Signed-off-by: DL3EL <dl3el@darc.de>
Signed-off-by: Thomas Osterried <dl9sau@darc.de>
master
Thomas Osterried 2024-04-03 08:25:45 +02:00
rodzic a8cf5ce0a1
commit 7dc1c3c728
1 zmienionych plików z 56 dodań i 39 usunięć

Wyświetl plik

@ -328,8 +328,10 @@ struct LastHeard LH[MAX_LH];
String RX_RAW_PACKET_LIST[3];
String LastRXMessage = "";
String LastRXMessageTimeAndSender = "";
uint8_t LastRXMessageInfo = 0; // bitmask: 1 personal aprs text message. 2 winlink message. 3 both. => Display maker: 1: "m", 2: "W", 3: "M"
String LastRXMessageSender = "";
String LastRXMessageTimeStr = "";
uint8_t LastRXMessageChanged = 0L;
uint8_t LastRXMessageInfo = 0; // bitmask: 1 personal aprs text message. 2 winlink message. 3 both. => Display maker: 1: "m", 2: "w", 3: "M"
//byte Variables
byte lora_TXStart; //start of packet data in TXbuff
@ -1649,17 +1651,13 @@ String getSatAndBatInfo() {
}
void fillDisplayLine1(int caller) {
//static String OledLine1s = "";
//OledLine1_time = gps_time_s;
// OledLine1s = " Up:" + String(millis()/1000/60) + "m";
if (freeze_display)
return;
if (debug_verbose > 2)
Serial.printf("fillDisplayLine1 caller:%d button_down:%d\r\n",caller, freeze_display);
static uint32_t old_time = 0L;
uint32_t t = millis() / 1000;
char s_uptime[9]; // room for 49d17:02 + \0 -> 9 bytes
char s_uptime[6]; // room for 49d17 + \0 -> 6 bytes
// > 49d 17h 2min? millis-overflow -> mark it
if (t < old_time)
@ -1672,14 +1670,12 @@ void fillDisplayLine1(int caller) {
int h = ((t / 60 / 60) % 24);
int m = ((t / 60) % 60);
if (d)
sprintf(s_uptime, "%dd%2.2d:%2.2d", d, h, m);
sprintf(s_uptime, "%2dd%2.2d", d % 100, h);
else
sprintf(s_uptime, "%2.2d:%2.2d", h, m);
old_time = t;
}
OledLine1 = String("Up ") + String(s_uptime);
if (*gps_time_s)
OledLine1 = String(gps_time_s) + String(" ") + OledLine1;
OledLine1 = String("Up:") + String(s_uptime);
if (LastRXMessageInfo == 3) {
// winlink and personal message -> "M"
OledLine1 += " M";
@ -1689,7 +1685,7 @@ void fillDisplayLine1(int caller) {
} else if (winlink_notified != 0L) {
if (winlink_notified + 60*60*24*1000L > millis()) {
// show winlink mail info for max 24h
OledLine1 += " W";
OledLine1 += " w";
} else {
// reset
winlink_notified = 0L;
@ -1698,6 +1694,8 @@ void fillDisplayLine1(int caller) {
LastRXMessageInfo &= ~2;
}
}
if (*gps_time_s)
OledLine1 = String(gps_time_s) + String(" ") + OledLine1;
}
void fillDisplayLine2() {
@ -5027,9 +5025,9 @@ void handle_usb_serial_input(void) {
if (cmd == "debug") {
if (arg != "") {
debug_verbose = arg.toInt();
Serial.printf("Debug Level now:%d (Arg: %s)\r\n", debug_verbose, arg.c_str());
Serial.printf("Debug Level now: %d (Arg: %s)\r\n", debug_verbose, arg.c_str());
} else {
Serial.printf("Debug Level:%d\r\n", debug_verbose);
Serial.printf("Debug Level: %d\r\n", debug_verbose);
}
Serial.print("cmd:");
inputBuf = "";
@ -5297,7 +5295,7 @@ void handle_usb_serial_input(void) {
} else if (cmd == "wifi") {
if (arg != "") {
#ifdef ENABLE_PREFERENCES
preferences.putInt(PREF_WIFI_ENABLE, (arg_bool) ? 0 : 1);
preferences.putInt(PREF_WIFI_ENABLE, arg_bool ? 1 : 0);
#if defined(ENABLE_SYSLOG)
if (debug_verbose)
syslog_log(LOG_DEBUG, String("FlashWrite preferences: handle_usb_serial_input() 5"));
@ -5322,6 +5320,8 @@ void handle_usb_serial_input(void) {
delay(1500);
esp_task_wdt_reset();
}
} else {
enable_webserver = 0;
}
}
Serial.println("*** " + cmd + " is " + (enable_webserver ? "on" : "off"));
@ -5462,13 +5462,18 @@ String handle_aprs_messsage_addressed_to_us(const char *received_frame) {
*q = 0;
enableOled_now(); // enable OLED
freeze_display = true;
String RXMessageTimeAndSender;
if (*gps_time_s)
RXMessageTimeAndSender = String(gps_time_s);
else
RXMessageTimeAndSender = String("@up ") + compute_time_since_received(millis()/1000);
RXMessageTimeAndSender = RXMessageTimeAndSender + String(" ") + String(msg_from) + ":";
String RXMessageSender = String(msg_from);
String RXMessageTimeAndSender = RXMessageSender + ":";
String RXMessage = String(header_normal_or_third_party_end + 11+1);
String RXMessageTimeStr = "";
struct tm timeinfo;
if (getLocalTimeTheBetterWay(&timeinfo)) {
char buf[12]; // Room for "03-22 06:08" + \0
strftime(buf, sizeof(buf), "%m-%d %H:%M", &timeinfo);
RXMessageTimeStr = String(buf);
// Add time to front
RXMessageTimeAndSender = RXMessageTimeStr + " " + RXMessageTimeAndSender;
}
writedisplaytext(" ((MSG))",RXMessageTimeAndSender,RXMessage,"","","");
if (add_winlink_notification &&
!strncmp(header_normal_or_third_party_start, "WLNK-1", 6) && header_normal_or_third_party_start[6] == '>' &&
@ -5478,15 +5483,19 @@ String handle_aprs_messsage_addressed_to_us(const char *received_frame) {
LastRXMessageInfo |= 2;
if (!(LastRXMessageInfo & 1)) {
// Store message
LastRXMessageTimeAndSender = String(RXMessageTimeAndSender);
LastRXMessageSender = String(RXMessageSender);
LastRXMessageTimeStr = String(RXMessageTimeStr);
LastRXMessage = String(RXMessage);
LastRXMessageChanged = millis();
}
winlink_notified = millis();
} else {
// Store message
LastRXMessageInfo |= 1;
LastRXMessageTimeAndSender = String(RXMessageTimeAndSender);
LastRXMessageSender = String(RXMessageSender);
LastRXMessageTimeStr = String(RXMessageTimeStr);
LastRXMessage = String(RXMessage);
LastRXMessageChanged = millis();
}
#ifdef ENABLE_WIFI
// TODO: add message to a new-to-implement web-received-list-for-aps-messages
@ -5753,21 +5762,29 @@ void loop()
if (button_down_count == 1) {
write_last_heard_calls_with_distance_and_course_to_display();
} else if (button_down_count == 2) {
writedisplaytext("((MSG))",LastRXMessageTimeAndSender,LastRXMessage,"","","");
} else if (button_down_count == 2) {
writedisplaytext("((BN))","","BuildNr:" + buildnr,"by DL9SAU & DL3EL","","");
String RXMessageTimeAndSender = "";
if (!LastRXMessageSender.isEmpty()) {
String RXMessageTimeStr;
if (LastRXMessageTimeStr.isEmpty()) {
RXMessageTimeStr = compute_time_since_received(millis()/1000L - LastRXMessageChanged/1000L) + " ago";
} else {
RXMessageTimeStr = LastRXMessageTimeStr;
}
RXMessageTimeAndSender = RXMessageTimeStr + " " + LastRXMessageSender + ":";
}
writedisplaytext("((MSG))",RXMessageTimeAndSender,LastRXMessage,"","","");
// Message has been displayed, we can remove the "new message-indicator"
if (LastRXMessageInfo & 2) {
// last received was a winlink notification and we just read that message
winlink_notified = 0L;
}
LastRXMessageInfo = 0;
} else if (button_down_count < 6) {
int n = button_down_count-3;
writedisplaytext("RX raw-" + String(n+1),"",RX_RAW_PACKET_LIST[n],"","","");
time_to_refresh = millis() + showRXTime;
} else if (button_down_count == 6) {
writedisplaytext("((BN))","BuildNr:" + buildnr,"by DL9SAU & DL3EL","","next press: tx bcn","or wait ...");
// If we cycled through to this last page, we can remove the "new message-indicator"
if (LastRXMessageInfo & 2) {
// last received was a winlink notification and we just read that message
winlink_notified = 0L;
}
LastRXMessageInfo = 0;
} else if (button_down_count == 7) {
button_down_count = 0;
if (lora_tx_enabled || aprsis_enabled) {
@ -6059,16 +6076,16 @@ if (t_elapsed > 15000L && ((curr_hdop < 1.5 && curr_sats >= 4) || gps_isValid !=
webServerCfg = {.callsign = Tcall};
xTaskCreate(taskWebServer, "taskWebServer", 12000, (void*)(&webServerCfg), 1, nullptr);
webserverStarted = true;
writedisplaytext("LoRa-APRS","","Button:","WiFi task started","long press to ","stop again");
writedisplaytext("LoRa-APRS","","Button:","WiFi task started","long press to ","stop again (->reboot)");
esp_task_wdt_reset();
delay(1500);
delay(3000);
esp_task_wdt_reset();
} else {
writedisplaytext("LoRa-APRS","","Rebooting:","to stop WiFi","do not press key","");
writedisplaytext("LoRa-APRS","","Button:","Rebooting,","for stoping WiFi.","Release Button now!");
#ifdef ENABLE_WIFI
do_send_status_message_about_reboot_to_aprsis();
#endif
delay(2000);
delay(3000);
ESP.restart();
}
#endif
@ -6161,10 +6178,10 @@ if (t_elapsed > 15000L && ((curr_hdop < 1.5 && curr_sats >= 4) || gps_isValid !=
if (shutdown_active && shutdown_countdown_timer_enable) {
shutdown_countdown_timer_enable = false;
writedisplaytext("((ABORT))","External Power","plugged in","Shutdown aborted","","");
freeze_display = true;
} else {
writedisplaytext("((POWER))","External Power","plugged in","","","");
}
freeze_display = true;
usb_status_before = true;
}
} else {
@ -6912,8 +6929,8 @@ behind_position_tx:
displayInvalidGPS();
}
} else {
// refresh time
fillDisplayLine1(5);
// refresh time -> check if necessary
//fillDisplayLine1(5);
}
}
}