-
Notifications
You must be signed in to change notification settings - Fork 963
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract default intervals and coalesce methods into their own file / …
…static class methods (#3425) * Extract default intervals and coalesce methods into their own file / static class methods * Missed pax * Still managed to miss one
- Loading branch information
1 parent
bb57ccf
commit 0d1d79b
Showing
20 changed files
with
103 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "Default.h" | ||
|
||
uint32_t Default::getConfiguredOrDefaultMs(uint32_t configuredInterval) | ||
{ | ||
if (configuredInterval > 0) | ||
return configuredInterval * 1000; | ||
return default_broadcast_interval_secs * 1000; | ||
} | ||
|
||
uint32_t Default::getConfiguredOrDefaultMs(uint32_t configuredInterval, uint32_t defaultInterval) | ||
{ | ||
if (configuredInterval > 0) | ||
return configuredInterval * 1000; | ||
return defaultInterval * 1000; | ||
} | ||
|
||
uint32_t Default::getConfiguredOrDefault(uint32_t configured, uint32_t defaultValue) | ||
{ | ||
if (configured > 0) | ||
return configured; | ||
|
||
return defaultValue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
#include <NodeDB.h> | ||
#include <cstdint> | ||
#define ONE_DAY 24 * 60 * 60 | ||
|
||
#define default_gps_update_interval IF_ROUTER(ONE_DAY, 2 * 60) | ||
#define default_broadcast_interval_secs IF_ROUTER(ONE_DAY / 2, 15 * 60) | ||
#define default_wait_bluetooth_secs IF_ROUTER(1, 60) | ||
#define default_sds_secs IF_ROUTER(ONE_DAY, UINT32_MAX) // Default to forever super deep sleep | ||
#define default_ls_secs IF_ROUTER(ONE_DAY, 5 * 60) | ||
#define default_min_wake_secs 10 | ||
#define default_screen_on_secs IF_ROUTER(1, 60 * 10) | ||
#define default_node_info_broadcast_secs 3 * 60 * 60 | ||
#define min_node_info_broadcast_secs 60 * 60 // No regular broadcasts of more than once an hour | ||
|
||
#define default_mqtt_address "mqtt.meshtastic.org" | ||
#define default_mqtt_username "meshdev" | ||
#define default_mqtt_password "large4cats" | ||
#define default_mqtt_root "msh" | ||
|
||
#define IF_ROUTER(routerVal, normalVal) \ | ||
((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) ? (routerVal) : (normalVal)) | ||
|
||
class Default | ||
{ | ||
public: | ||
static uint32_t getConfiguredOrDefaultMs(uint32_t configuredInterval); | ||
static uint32_t getConfiguredOrDefaultMs(uint32_t configuredInterval, uint32_t defaultInterval); | ||
static uint32_t getConfiguredOrDefault(uint32_t configured, uint32_t defaultValue); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
#ifdef ARCH_PORTDUINO | ||
#include "unistd.h" | ||
#endif | ||
#include "Default.h" | ||
|
||
#include "mqtt/MQTT.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.