Added "S" for Stay On to status display

pull/8/head
Max-Plastix 2022-01-21 08:47:15 -08:00
rodzic 2049c7a3a0
commit fd5b5ca58a
3 zmienionych plików z 20 dodań i 14 usunięć

Wyświetl plik

@ -867,7 +867,7 @@ struct menu_entry menu[] = {
{"Send Now", menu_send_now}, {"Power Off", menu_power_off}, {"Distance +", menu_distance_plus},
{"Distance -", menu_distance_minus}, {"Time +", menu_time_plus}, {"Time -", menu_time_minus},
{"Change SF", menu_change_sf}, {"Flush Prefs", menu_flush_prefs}, {"USB GPS", menu_gps_passthrough},
{"Deadzone Here", menu_deadzone_here}, {"Stay On", menu_stay_on}, {"Danger", menu_experiment}};
{"Deadzone Here", menu_deadzone_here}, {"Stay On", menu_stay_on}, {"Experiment", menu_experiment}};
#define MENU_ENTRIES (sizeof(menu) / sizeof(menu[0]))
const char *menu_prev;
@ -896,6 +896,11 @@ void menu_selected(void) {
menu[menu_entry].func();
}
void update_screen (void){
screen_header(tx_interval_s, min_dist_moved, sf_name, gps_sats(), in_deadzone, screen_stay_on);
screen_body(in_menu, menu_prev, menu_cur, menu_next, is_highlighted);
}
void loop() {
gps_loop();
ttn_loop();
@ -903,9 +908,7 @@ void loop() {
if (in_menu && millis() - menu_idle_start > (5 * 1000))
in_menu = false;
screen_loop(tx_interval_s, min_dist_moved, sf_name, gps_sats(), in_menu, menu_prev, menu_cur, menu_next,
is_highlighted, in_deadzone);
update_screen();
update_activity();
// If any interrupts on PMIC, report the name

Wyświetl plik

@ -114,12 +114,14 @@ void screen_setup() {
extern AXP20X_Class axp; // TODO: This is evil
void screen_header(unsigned int tx_interval_s, float min_dist_moved, char *cached_sf_name, int sats,
boolean in_deadzone) {
boolean in_deadzone, boolean stay_on) {
if (!display)
return;
char buffer[40];
display->clear();
// Cycle display every 3 seconds
if (millis() % 6000 < 3000) {
// 2 bytes of Device EUI with Voltage and Current
@ -151,7 +153,8 @@ void screen_header(unsigned int tx_interval_s, float min_dist_moved, char *cache
SATELLITE_IMAGE);
// Second status row:
snprintf(buffer, sizeof(buffer), "%us %.0fm %c", tx_interval_s, min_dist_moved, in_deadzone ? 'D' : ' ');
snprintf(buffer, sizeof(buffer), "%us %.0fm %c%c", tx_interval_s, min_dist_moved, in_deadzone ? 'D' : ' ',
stay_on ? 'S' : ' ');
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->drawString(0, 12, buffer);
@ -162,15 +165,11 @@ void screen_header(unsigned int tx_interval_s, float min_dist_moved, char *cache
}
#define MARGIN 15
void screen_loop(unsigned int tx_interval_s, float min_dist_moved, char *cached_sf_name, int sats, boolean in_menu,
const char *menu_prev, const char *menu_cur, const char *menu_next, boolean highlighted,
boolean in_deadzone) {
void screen_body(boolean in_menu, const char *menu_prev, const char *menu_cur, const char *menu_next,
boolean highlighted) {
if (!display)
return;
display->clear();
screen_header(tx_interval_s, min_dist_moved, cached_sf_name, sats, in_deadzone);
if (in_menu) {
char buffer[40];

Wyświetl plik

@ -6,8 +6,12 @@ void screen_print(const char *text, uint8_t x, uint8_t y);
void screen_print(const char *text, uint8_t x, uint8_t y, uint8_t alignment);
void screen_update(void);
void screen_loop(unsigned int tx_interval_ms, float min_dist_moved, char *cached_sf_name, int sats, boolean in_menu, const char *menu_prev,
const char *menu_cur, const char *menu_next, boolean highlighted, boolean in_deadzone);
void screen_body(boolean in_menu, const char *menu_prev, const char *menu_cur, const char *menu_next,
boolean highlighted);
void screen_header(unsigned int tx_interval_s, float min_dist_moved, char *cached_sf_name, int sats,
boolean in_deadzone, boolean stay_on);
void screen_off(void);
void screen_on(void);