Added screen message on auto detect and added track global write on detect

This commit is contained in:
2026-03-25 19:58:42 +01:00
parent 21a5fd3244
commit a5b53afb2c
3 changed files with 40 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ enum task_type : uint8_t {
TASK_NULL, TASK_NULL,
TASK_DISPLAY_GPS_DEBUG, TASK_DISPLAY_GPS_DEBUG,
TASK_DISPLAY_MSG_GPS_FIX, TASK_DISPLAY_MSG_GPS_FIX,
TASK_DISPLAY_MSG_TRACK_DETECT_OK,
TASK_CONFIG_TRACK_DETECT, TASK_CONFIG_TRACK_DETECT,
}; };

View File

@@ -10,6 +10,8 @@
#include "modules/logger/system_logger.h" #include "modules/logger/system_logger.h"
#include <EEPROM.h> #include <EEPROM.h>
#include "data/gps_store.h" #include "data/gps_store.h"
#include "data/track_store.h"
#include "base/router.h"
struct task_config_track_detect_data { struct task_config_track_detect_data {
unsigned short last_checked = 0; unsigned short last_checked = 0;
@@ -96,6 +98,7 @@ int config::task_config_detect_track(unsigned long timeout_ms) {
this->load_track(task_data.smallest_idx); this->load_track(task_data.smallest_idx);
_task_memory_stale = true; _task_memory_stale = true;
_active_task = {MOD_NULL, TASK_NULL, 0}; _active_task = {MOD_NULL, TASK_NULL, 0};
router::send(MOD_LCD, TASK_DISPLAY_MSG_TRACK_DETECT_OK, 4000);
return 0; return 0;
} }
} }
@@ -184,5 +187,6 @@ int config::load_track(unsigned int idx) {
return 1; return 1;
} }
_loaded_track = temp; _loaded_track = temp;
track_global_write(_loaded_track);
return 0; return 0;
} }

View File

@@ -10,6 +10,7 @@
#include "base/ring_buffer.h" #include "base/ring_buffer.h"
#include "base/module_base.h" #include "base/module_base.h"
#include "data/gps_store.h" #include "data/gps_store.h"
#include "data/track_store.h"
#define MOD "modules/lcd/lcd.h" #define MOD "modules/lcd/lcd.h"
namespace screen namespace screen
@@ -19,6 +20,7 @@ typedef enum lcd_screen {
blank, blank,
gps_debug, gps_debug,
msg_gps_fix, msg_gps_fix,
msg_track_detect_ok,
}; };
} // namespace screen } // namespace screen
@@ -46,6 +48,7 @@ private:
int render_gps_debug(); int render_gps_debug();
int render_msg_gps_fix(); int render_msg_gps_fix();
int render_msg_track_detect_ok();
public: public:
int push(const Task& task) override; int push(const Task& task) override;
lcd(); lcd();
@@ -146,10 +149,24 @@ int lcd::render_gps_debug() {
int lcd::render_msg_gps_fix() { int lcd::render_msg_gps_fix() {
this->clear(); this->clear();
_display->setCursor(0,2); _display->setCursor(6,1);
this->print("INFO"); this->print("GPS INFO");
_display->setCursor(0,3); _display->setCursor(7,2);
this->print("GPS FIX OK"); this->print("FIX OK");
return 0;
}
int lcd::render_msg_track_detect_ok() {
this->clear();
_display->setCursor(6,0);
this->print("GPS INFO");
_display->setCursor(3,1);
this->print("TRACK DETECTED");
track_data temp;
track_global_read(temp);
strlen(temp.name);
_display->setCursor((20 - strlen(temp.name))/2, 2);
this->print(temp.name);
return 0; return 0;
} }
@@ -288,6 +305,16 @@ int lcd::loop(unsigned long timeout_ms) {
} }
_hold_till_frame = _frame_ctr + _msg_duration; _hold_till_frame = _frame_ctr + _msg_duration;
break; break;
case TASK_DISPLAY_MSG_TRACK_DETECT_OK:
_previous_screen = _screen;
_screen = screen::msg_track_detect_ok;
unsigned long _msg_duration = next_task.data/_frame_duration;
if (_msg_duration == 0) {
_msg_duration == 1;
}
_hold_till_frame = _frame_ctr + _msg_duration;
break;
default: default:
break; break;
@@ -318,6 +345,10 @@ int lcd::loop(unsigned long timeout_ms) {
case screen::msg_gps_fix: case screen::msg_gps_fix:
this->render_msg_gps_fix(); this->render_msg_gps_fix();
break; break;
case screen::msg_track_detect_ok:
this->render_msg_track_detect_ok();
break;
default: default:
break; break;