mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 13:46:37 +00:00
Prep global struct
This commit is contained in:
parent
85d2626e84
commit
66f5d5d180
@ -1632,7 +1632,7 @@ bool TimeReached(uint32_t timer)
|
|||||||
return (passed >= 0);
|
return (passed >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetNextTimeInterval(unsigned long& timer, const unsigned long step)
|
void SetNextTimeInterval(uint32_t& timer, const uint32_t step)
|
||||||
{
|
{
|
||||||
timer += step;
|
timer += step;
|
||||||
const long passed = TimePassedSince(timer);
|
const long passed = TimePassedSince(timer);
|
||||||
|
@ -33,7 +33,7 @@ const char kMultiPress[] PROGMEM =
|
|||||||
"|SINGLE|DOUBLE|TRIPLE|QUAD|PENTA|";
|
"|SINGLE|DOUBLE|TRIPLE|QUAD|PENTA|";
|
||||||
|
|
||||||
struct BUTTON {
|
struct BUTTON {
|
||||||
unsigned long debounce = 0; // Button debounce timer
|
uint32_t debounce = 0; // Button debounce timer
|
||||||
uint16_t hold_timer[MAX_KEYS] = { 0 }; // Timer for button hold
|
uint16_t hold_timer[MAX_KEYS] = { 0 }; // Timer for button hold
|
||||||
uint16_t dual_code = 0; // Sonoff dual received code
|
uint16_t dual_code = 0; // Sonoff dual received code
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ const uint8_t AC_PERIOD = (20 + SWITCH_FAST_PROBE_INTERVAL - 1) / SWITCH_FAST_PR
|
|||||||
Ticker TickerSwitch;
|
Ticker TickerSwitch;
|
||||||
|
|
||||||
struct SWITCH {
|
struct SWITCH {
|
||||||
unsigned long debounce = 0; // Switch debounce timer
|
uint32_t debounce = 0; // Switch debounce timer
|
||||||
uint16_t no_pullup_mask = 0; // Switch pull-up bitmask flags
|
uint16_t no_pullup_mask = 0; // Switch pull-up bitmask flags
|
||||||
uint8_t state[MAX_SWITCHES] = { 0 };
|
uint8_t state[MAX_SWITCHES] = { 0 };
|
||||||
uint8_t last_state[MAX_SWITCHES]; // Last wall switch states
|
uint8_t last_state[MAX_SWITCHES]; // Last wall switch states
|
||||||
|
@ -666,8 +666,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long wifiTimer = 0;
|
|
||||||
|
|
||||||
void stationKeepAliveNow(void) {
|
void stationKeepAliveNow(void) {
|
||||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI "Sending Gratuitous ARP"));
|
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_WIFI "Sending Gratuitous ARP"));
|
||||||
for (netif* interface = netif_list; interface != nullptr; interface = interface->next)
|
for (netif* interface = netif_list; interface != nullptr; interface = interface->next)
|
||||||
@ -693,11 +691,11 @@ void wifiKeepAlive(void) {
|
|||||||
|
|
||||||
if ((WL_CONNECTED != Wifi.status) || (0 == wifiTimerSec)) { return; } // quick exit if wifi not connected or feature disabled
|
if ((WL_CONNECTED != Wifi.status) || (0 == wifiTimerSec)) { return; } // quick exit if wifi not connected or feature disabled
|
||||||
|
|
||||||
if (TimeReached(wifiTimer)) {
|
if (TimeReached(wifi_timer)) {
|
||||||
stationKeepAliveNow();
|
stationKeepAliveNow();
|
||||||
if (wifiTimerSec > 100) {
|
if (wifiTimerSec > 100) {
|
||||||
wifiTimerSec = (wifiTimerSec - 100) * 60; // convert >100 as minutes, ex: 105 = 5 minutes, 110 = 10 minutes
|
wifiTimerSec = (wifiTimerSec - 100) * 60; // convert >100 as minutes, ex: 105 = 5 minutes, 110 = 10 minutes
|
||||||
}
|
}
|
||||||
SetNextTimeInterval(wifiTimer, wifiTimerSec * 1000);
|
SetNextTimeInterval(wifi_timer, wifiTimerSec * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,14 +77,20 @@
|
|||||||
|
|
||||||
WiFiUDP PortUdp; // UDP Syslog and Alexa
|
WiFiUDP PortUdp; // UDP Syslog and Alexa
|
||||||
|
|
||||||
unsigned long serial_polling_window = 0; // Serial polling window
|
uint32_t serial_polling_window = 0; // Serial polling window
|
||||||
unsigned long state_second = 0; // State second timer
|
uint32_t state_second = 0; // State second timer
|
||||||
unsigned long state_50msecond = 0; // State 50msecond timer
|
uint32_t state_50msecond = 0; // State 50msecond timer
|
||||||
unsigned long state_100msecond = 0; // State 100msecond timer
|
uint32_t state_100msecond = 0; // State 100msecond timer
|
||||||
unsigned long state_250msecond = 0; // State 250msecond timer
|
uint32_t state_250msecond = 0; // State 250msecond timer
|
||||||
unsigned long pulse_timer[MAX_PULSETIMERS] = { 0 }; // Power off timer
|
uint32_t pulse_timer[MAX_PULSETIMERS] = { 0 }; // Power off timer
|
||||||
unsigned long blink_timer = 0; // Power cycle timer
|
uint32_t wifi_timer = 0; // Wifi keepalive timer
|
||||||
unsigned long backlog_delay = 0; // Command backlog delay
|
uint32_t blink_timer = 0; // Power cycle timer
|
||||||
|
uint32_t backlog_delay = 0; // Command backlog delay
|
||||||
|
uint32_t uptime = 0; // Counting every second until 4294967295 = 130 year
|
||||||
|
uint32_t loop_load_avg = 0; // Indicative loop load average
|
||||||
|
uint32_t global_update = 0; // Timestamp of last global temperature and humidity update
|
||||||
|
uint32_t web_log_index = 1; // Index in Web log buffer (should never be 0)
|
||||||
|
uint32_t baudrate = APP_BAUDRATE; // Current Serial baudrate
|
||||||
power_t power = 0; // Current copy of Settings.power
|
power_t power = 0; // Current copy of Settings.power
|
||||||
power_t last_power = 0; // Last power set state
|
power_t last_power = 0; // Last power set state
|
||||||
power_t blink_power; // Blink power state
|
power_t blink_power; // Blink power state
|
||||||
@ -98,11 +104,6 @@ int ota_result = 0; // OTA result
|
|||||||
int restart_flag = 0; // Tasmota restart flag
|
int restart_flag = 0; // Tasmota restart flag
|
||||||
int wifi_state_flag = WIFI_RESTART; // Wifi state flag
|
int wifi_state_flag = WIFI_RESTART; // Wifi state flag
|
||||||
int blinks = 201; // Number of LED blinks
|
int blinks = 201; // Number of LED blinks
|
||||||
uint32_t uptime = 0; // Counting every second until 4294967295 = 130 year
|
|
||||||
uint32_t loop_load_avg = 0; // Indicative loop load average
|
|
||||||
uint32_t global_update = 0; // Timestamp of last global temperature and humidity update
|
|
||||||
uint32_t web_log_index = 1; // Index in Web log buffer (should never be 0)
|
|
||||||
uint32_t baudrate = APP_BAUDRATE; // Current Serial baudrate
|
|
||||||
float global_temperature_celsius = NAN; // Provide a global temperature to be used by some sensors
|
float global_temperature_celsius = NAN; // Provide a global temperature to be used by some sensors
|
||||||
float global_humidity = 0.0f; // Provide a global humidity to be used by some sensors
|
float global_humidity = 0.0f; // Provide a global humidity to be used by some sensors
|
||||||
float global_pressure_hpa = 0.0f; // Provide a global pressure to be used by some sensors
|
float global_pressure_hpa = 0.0f; // Provide a global pressure to be used by some sensors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user