Wessel Nieboer
5 months ago
committed by
Wessel Nieboer
No known key found for this signature in database
GPG Key ID: 929C8E45E33B5FD2
10 changed files with
18 additions and
17 deletions
-
examples/companion_radio/ui-new/UITask.cpp
-
examples/companion_radio/ui-new/UITask.h
-
examples/companion_radio/ui-orig/UITask.cpp
-
src/helpers/NRF52Board.cpp
-
variants/heltec_mesh_solar/target.cpp
-
variants/heltec_tracker/target.cpp
-
variants/meshadventurer/target.cpp
-
variants/nano_g2_ultra/target.cpp
-
variants/t1000-e/target.cpp
-
variants/thinknode_m1/target.cpp
|
|
|
@ -153,7 +153,8 @@ class HomeScreen : public UIScreen { |
|
|
|
int sensors_nb = 0; |
|
|
|
bool sensors_scroll = false; |
|
|
|
int sensors_scroll_offset = 0; |
|
|
|
int next_sensors_refresh = 0; |
|
|
|
unsigned long next_sensors_refresh = 0; |
|
|
|
|
|
|
|
|
|
|
|
void refresh_sensors() { |
|
|
|
if (millis_passed(next_sensors_refresh)) { |
|
|
|
@ -652,8 +653,8 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i |
|
|
|
|
|
|
|
void UITask::userLedHandler() { |
|
|
|
#ifdef PIN_STATUS_LED |
|
|
|
int cur_time = millis(); |
|
|
|
if (cur_time > next_led_change) { |
|
|
|
unsigned long cur_time = millis(); |
|
|
|
if (millis_passed(next_led_change)) { |
|
|
|
if (led_state == 0) { |
|
|
|
led_state = 1; |
|
|
|
if (_msgcount > 0) { |
|
|
|
|
|
|
|
@ -37,10 +37,10 @@ class UITask : public AbstractUITask { |
|
|
|
unsigned long _alert_expiry; |
|
|
|
int _msgcount; |
|
|
|
unsigned long ui_started_at, next_batt_chck; |
|
|
|
int next_backlight_btn_check = 0; |
|
|
|
unsigned long next_backlight_btn_check = 0; |
|
|
|
#ifdef PIN_STATUS_LED |
|
|
|
int led_state = 0; |
|
|
|
int next_led_change = 0; |
|
|
|
unsigned long next_led_change = 0; |
|
|
|
int last_led_increment = 0; |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
@ -264,11 +264,11 @@ void UITask::renderCurrScreen() { |
|
|
|
void UITask::userLedHandler() { |
|
|
|
#ifdef PIN_STATUS_LED |
|
|
|
static int state = 0; |
|
|
|
static int next_change = 0; |
|
|
|
static unsigned long next_change = 0; |
|
|
|
static int last_increment = 0; |
|
|
|
|
|
|
|
int cur_time = millis(); |
|
|
|
if (cur_time > next_change) { |
|
|
|
unsigned long cur_time = millis(); |
|
|
|
if (millis_passed(next_change)) { |
|
|
|
if (state == 0) { |
|
|
|
state = 1; |
|
|
|
if (_msgcount > 0) { |
|
|
|
|
|
|
|
@ -294,7 +294,7 @@ float NRF52Board::getMCUTemperature() { |
|
|
|
} else { |
|
|
|
NRF_TEMP->TASKS_START = 1; // Start temperature measurement
|
|
|
|
|
|
|
|
long startTime = millis(); |
|
|
|
unsigned long startTime = millis(); |
|
|
|
while (NRF_TEMP->EVENTS_DATARDY == 0) { // Wait for completion. Should complete in 50us
|
|
|
|
if(millis() - startTime > 5) { // To wait 5ms just in case
|
|
|
|
NRF_TEMP->TASKS_STOP = 1; |
|
|
|
|
|
|
|
@ -66,7 +66,7 @@ bool SolarSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& |
|
|
|
} |
|
|
|
|
|
|
|
void SolarSensorManager::loop() { |
|
|
|
static long next_gps_update = 0; |
|
|
|
static unsigned long next_gps_update = 0; |
|
|
|
|
|
|
|
_location->loop(); |
|
|
|
|
|
|
|
|
|
|
|
@ -72,7 +72,7 @@ bool HWTSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& t |
|
|
|
} |
|
|
|
|
|
|
|
void HWTSensorManager::loop() { |
|
|
|
static long next_gps_update = 0; |
|
|
|
static unsigned long next_gps_update = 0; |
|
|
|
|
|
|
|
_location->loop(); |
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +66,7 @@ bool MASensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& te |
|
|
|
} |
|
|
|
|
|
|
|
void MASensorManager::loop() { |
|
|
|
static long next_gps_update = 0; |
|
|
|
static unsigned long next_gps_update = 0; |
|
|
|
_location->loop(); |
|
|
|
if(millis_passed(next_gps_update) && gps_active) { |
|
|
|
if(_location->isValid()) { |
|
|
|
|
|
|
|
@ -73,7 +73,7 @@ bool NanoG2UltraSensorManager::querySensors(uint8_t requester_permissions, Cayen |
|
|
|
} |
|
|
|
|
|
|
|
void NanoG2UltraSensorManager::loop() { |
|
|
|
static long next_gps_update = 0; |
|
|
|
static unsigned long next_gps_update = 0; |
|
|
|
|
|
|
|
if (!gps_active) { |
|
|
|
return; // GPS is not active, skip further processing
|
|
|
|
|
|
|
|
@ -148,7 +148,7 @@ bool T1000SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& |
|
|
|
} |
|
|
|
|
|
|
|
void T1000SensorManager::loop() { |
|
|
|
static long next_gps_update = 0; |
|
|
|
static unsigned long next_gps_update = 0; |
|
|
|
|
|
|
|
_nmea->loop(); |
|
|
|
|
|
|
|
|
|
|
|
@ -69,11 +69,11 @@ bool ThinkNodeM1SensorManager::querySensors(uint8_t requester_permissions, Cayen |
|
|
|
} |
|
|
|
|
|
|
|
void ThinkNodeM1SensorManager::loop() { |
|
|
|
static long next_gps_update = 0; |
|
|
|
static long last_switch_check = 0; |
|
|
|
static unsigned long next_gps_update = 0; |
|
|
|
static unsigned long last_switch_check = 0; |
|
|
|
|
|
|
|
// Check GPS switch state every second
|
|
|
|
if (millis() - last_switch_check > 1000) { |
|
|
|
if (millis_passed(last_switch_check + 1000)) { |
|
|
|
bool current_switch_state = digitalRead(PIN_GPS_SWITCH); |
|
|
|
|
|
|
|
// Detect switch state change
|
|
|
|
|