mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-23 10:17:37 +00:00
Compare commits
55 Commits
fix-bme
...
InkHUD-Imp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff86e1c955 | ||
|
|
d8d02cd6ec | ||
|
|
eefc08087d | ||
|
|
fb6d199d36 | ||
|
|
7d4600f8c2 | ||
|
|
ff50ba4002 | ||
|
|
5c401b8e34 | ||
|
|
c96ebf15fd | ||
|
|
3e4239daf8 | ||
|
|
ab97c0126f | ||
|
|
d34d694731 | ||
|
|
caa6ec0e8a | ||
|
|
d1d032929b | ||
|
|
afbd9e2180 | ||
|
|
0b6ed2da20 | ||
|
|
64116cd0d3 | ||
|
|
e73e817bf2 | ||
|
|
db0ca0324e | ||
|
|
750f695bbd | ||
|
|
2cbb8040f3 | ||
|
|
ef128a7883 | ||
|
|
d55bf66f25 | ||
|
|
1885a2beac | ||
|
|
d5ef68314b | ||
|
|
3baba4b1a1 | ||
|
|
791fb86c7c | ||
|
|
c1c5d36e86 | ||
|
|
050371adc5 | ||
|
|
f409645ad3 | ||
|
|
25d7db65ea | ||
|
|
e0ceaaff38 | ||
|
|
6431c76aac | ||
|
|
ac0b3613ec | ||
|
|
9ad7d39051 | ||
|
|
b3e6731c85 | ||
|
|
ef36a5a24d | ||
|
|
66d9c430d8 | ||
|
|
ac05337e42 | ||
|
|
1d4e295471 | ||
|
|
c761444bee | ||
|
|
929aa5c968 | ||
|
|
cc6265e9b1 | ||
|
|
958e1f73ef | ||
|
|
96e82f1ec1 | ||
|
|
83ec37113d | ||
|
|
5acf72243d | ||
|
|
bd18a171d4 | ||
|
|
6e05c554b8 | ||
|
|
5f9a6a38e6 | ||
|
|
a332ca978b | ||
|
|
7b4315421b | ||
|
|
60389e84e6 | ||
|
|
cd0843c7db | ||
|
|
d9dab0cd6c | ||
|
|
87114f4052 |
@@ -9,14 +9,14 @@ plugins:
|
|||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- checkov@3.2.497
|
- checkov@3.2.497
|
||||||
- renovate@42.81.8
|
- renovate@42.84.2
|
||||||
- prettier@3.8.0
|
- prettier@3.8.0
|
||||||
- trufflehog@3.92.4
|
- trufflehog@3.92.5
|
||||||
- yamllint@1.38.0
|
- yamllint@1.38.0
|
||||||
- bandit@1.9.2
|
- bandit@1.9.3
|
||||||
- trivy@0.68.2
|
- trivy@0.68.2
|
||||||
- taplo@0.10.0
|
- taplo@0.10.0
|
||||||
- ruff@0.14.11
|
- ruff@0.14.13
|
||||||
- isort@7.0.0
|
- isort@7.0.0
|
||||||
- markdownlint@0.47.0
|
- markdownlint@0.47.0
|
||||||
- oxipng@10.0.0
|
- oxipng@10.0.0
|
||||||
@@ -26,7 +26,7 @@ lint:
|
|||||||
- hadolint@2.14.0
|
- hadolint@2.14.0
|
||||||
- shfmt@3.6.0
|
- shfmt@3.6.0
|
||||||
- shellcheck@0.11.0
|
- shellcheck@0.11.0
|
||||||
- black@25.12.0
|
- black@26.1.0
|
||||||
- git-diff-check
|
- git-diff-check
|
||||||
- gitleaks@8.30.0
|
- gitleaks@8.30.0
|
||||||
- clang-format@16.0.3
|
- clang-format@16.0.3
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ lib_deps =
|
|||||||
[device-ui_base]
|
[device-ui_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
||||||
https://github.com/meshtastic/device-ui/archive/5a870c623a4e9ab7a7abe3d02950536f107d1a31.zip
|
https://github.com/meshtastic/device-ui/archive/3480b731d28b10d73414cf0dd7975bff745de8cf.zip
|
||||||
|
|
||||||
; Common libs for environmental measurements in telemetry module
|
; Common libs for environmental measurements in telemetry module
|
||||||
[environmental_base]
|
[environmental_base]
|
||||||
@@ -212,3 +212,30 @@ lib_deps =
|
|||||||
sensirion/Sensirion Core@0.7.2
|
sensirion/Sensirion Core@0.7.2
|
||||||
# renovate: datasource=custom.pio depName=Sensirion I2C SCD4x packageName=sensirion/library/Sensirion I2C SCD4x
|
# renovate: datasource=custom.pio depName=Sensirion I2C SCD4x packageName=sensirion/library/Sensirion I2C SCD4x
|
||||||
sensirion/Sensirion I2C SCD4x@1.1.0
|
sensirion/Sensirion I2C SCD4x@1.1.0
|
||||||
|
; Same as environmental_extra but without BSEC (saves ~3.5KB DRAM for original ESP32 targets)
|
||||||
|
[environmental_extra_no_bsec]
|
||||||
|
lib_deps =
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit BMP3XX packageName=adafruit/library/Adafruit BMP3XX Library
|
||||||
|
adafruit/Adafruit BMP3XX Library@2.1.6
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit MAX1704X packageName=adafruit/library/Adafruit MAX1704X
|
||||||
|
adafruit/Adafruit MAX1704X@1.0.3
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit SHTC3 packageName=adafruit/library/Adafruit SHTC3 Library
|
||||||
|
adafruit/Adafruit SHTC3 Library@1.0.2
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit LPS2X packageName=adafruit/library/Adafruit LPS2X
|
||||||
|
adafruit/Adafruit LPS2X@2.0.6
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit SHT31 packageName=adafruit/library/Adafruit SHT31 Library
|
||||||
|
adafruit/Adafruit SHT31 Library@2.2.2
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit VEML7700 packageName=adafruit/library/Adafruit VEML7700 Library
|
||||||
|
adafruit/Adafruit VEML7700 Library@2.1.6
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit SHT4x packageName=adafruit/library/Adafruit SHT4x Library
|
||||||
|
adafruit/Adafruit SHT4x Library@1.0.5
|
||||||
|
# renovate: datasource=custom.pio depName=SparkFun Qwiic Scale NAU7802 packageName=sparkfun/library/SparkFun Qwiic Scale NAU7802 Arduino Library
|
||||||
|
sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6
|
||||||
|
# renovate: datasource=custom.pio depName=ClosedCube OPT3001 packageName=closedcube/library/ClosedCube OPT3001
|
||||||
|
closedcube/ClosedCube OPT3001@1.1.2
|
||||||
|
# renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master
|
||||||
|
https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip
|
||||||
|
# renovate: datasource=custom.pio depName=Sensirion Core packageName=sensirion/library/Sensirion Core
|
||||||
|
sensirion/Sensirion Core@0.7.2
|
||||||
|
# renovate: datasource=custom.pio depName=Sensirion I2C SCD4x packageName=sensirion/library/Sensirion I2C SCD4x
|
||||||
|
sensirion/Sensirion I2C SCD4x@1.1.0
|
||||||
Submodule protobufs updated: 4b9f104a18...77c8329a59
@@ -155,6 +155,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Default system gain to 0 if not defined
|
// Default system gain to 0 if not defined
|
||||||
|
#ifndef NUM_PA_POINTS
|
||||||
|
#define NUM_PA_POINTS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef TX_GAIN_LORA
|
#ifndef TX_GAIN_LORA
|
||||||
#define TX_GAIN_LORA 0
|
#define TX_GAIN_LORA 0
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -155,6 +155,18 @@ void InkHUD::LogoApplet::onShutdown()
|
|||||||
// This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete
|
// This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InkHUD::LogoApplet::onApplyingChanges()
|
||||||
|
{
|
||||||
|
bringToForeground();
|
||||||
|
|
||||||
|
textLeft = "";
|
||||||
|
textRight = "";
|
||||||
|
textTitle = "Applying changes";
|
||||||
|
fontTitle = fontSmall;
|
||||||
|
|
||||||
|
inkhud->forceUpdate(Drivers::EInk::FAST, false);
|
||||||
|
}
|
||||||
|
|
||||||
void InkHUD::LogoApplet::onReboot()
|
void InkHUD::LogoApplet::onReboot()
|
||||||
{
|
{
|
||||||
bringToForeground();
|
bringToForeground();
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class LogoApplet : public SystemApplet, public concurrency::OSThread
|
|||||||
void onBackground() override;
|
void onBackground() override;
|
||||||
void onShutdown() override;
|
void onShutdown() override;
|
||||||
void onReboot() override;
|
void onReboot() override;
|
||||||
|
void onApplyingChanges();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32_t runOnce() override;
|
int32_t runOnce() override;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ enum MenuAction {
|
|||||||
STORE_CANNEDMESSAGE_SELECTION,
|
STORE_CANNEDMESSAGE_SELECTION,
|
||||||
SEND_CANNEDMESSAGE,
|
SEND_CANNEDMESSAGE,
|
||||||
SHUTDOWN,
|
SHUTDOWN,
|
||||||
|
BACK,
|
||||||
NEXT_TILE,
|
NEXT_TILE,
|
||||||
TOGGLE_BACKLIGHT,
|
TOGGLE_BACKLIGHT,
|
||||||
TOGGLE_GPS,
|
TOGGLE_GPS,
|
||||||
@@ -36,6 +37,84 @@ enum MenuAction {
|
|||||||
TOGGLE_NOTIFICATIONS,
|
TOGGLE_NOTIFICATIONS,
|
||||||
TOGGLE_INVERT_COLOR,
|
TOGGLE_INVERT_COLOR,
|
||||||
TOGGLE_12H_CLOCK,
|
TOGGLE_12H_CLOCK,
|
||||||
|
// Regions
|
||||||
|
SET_REGION_US,
|
||||||
|
SET_REGION_EU_868,
|
||||||
|
SET_REGION_EU_433,
|
||||||
|
SET_REGION_CN,
|
||||||
|
SET_REGION_JP,
|
||||||
|
SET_REGION_ANZ,
|
||||||
|
SET_REGION_KR,
|
||||||
|
SET_REGION_TW,
|
||||||
|
SET_REGION_RU,
|
||||||
|
SET_REGION_IN,
|
||||||
|
SET_REGION_NZ_865,
|
||||||
|
SET_REGION_TH,
|
||||||
|
SET_REGION_LORA_24,
|
||||||
|
SET_REGION_UA_433,
|
||||||
|
SET_REGION_UA_868,
|
||||||
|
SET_REGION_MY_433,
|
||||||
|
SET_REGION_MY_919,
|
||||||
|
SET_REGION_SG_923,
|
||||||
|
SET_REGION_PH_433,
|
||||||
|
SET_REGION_PH_868,
|
||||||
|
SET_REGION_PH_915,
|
||||||
|
SET_REGION_ANZ_433,
|
||||||
|
SET_REGION_KZ_433,
|
||||||
|
SET_REGION_KZ_863,
|
||||||
|
SET_REGION_NP_865,
|
||||||
|
SET_REGION_BR_902,
|
||||||
|
// Device Roles
|
||||||
|
SET_ROLE_CLIENT,
|
||||||
|
SET_ROLE_CLIENT_MUTE,
|
||||||
|
SET_ROLE_ROUTER,
|
||||||
|
SET_ROLE_REPEATER,
|
||||||
|
// Presets
|
||||||
|
SET_PRESET_LONG_SLOW,
|
||||||
|
SET_PRESET_LONG_MODERATE,
|
||||||
|
SET_PRESET_LONG_FAST,
|
||||||
|
SET_PRESET_MEDIUM_SLOW,
|
||||||
|
SET_PRESET_MEDIUM_FAST,
|
||||||
|
SET_PRESET_SHORT_SLOW,
|
||||||
|
SET_PRESET_SHORT_FAST,
|
||||||
|
SET_PRESET_SHORT_TURBO,
|
||||||
|
// Timezones
|
||||||
|
SET_TZ_US_HAWAII,
|
||||||
|
SET_TZ_US_ALASKA,
|
||||||
|
SET_TZ_US_PACIFIC,
|
||||||
|
SET_TZ_US_ARIZONA,
|
||||||
|
SET_TZ_US_MOUNTAIN,
|
||||||
|
SET_TZ_US_CENTRAL,
|
||||||
|
SET_TZ_US_EASTERN,
|
||||||
|
SET_TZ_BR_BRAZILIA,
|
||||||
|
SET_TZ_UTC,
|
||||||
|
SET_TZ_EU_WESTERN,
|
||||||
|
SET_TZ_EU_CENTRAL,
|
||||||
|
SET_TZ_EU_EASTERN,
|
||||||
|
SET_TZ_ASIA_KOLKATA,
|
||||||
|
SET_TZ_ASIA_HONG_KONG,
|
||||||
|
SET_TZ_AU_AWST,
|
||||||
|
SET_TZ_AU_ACST,
|
||||||
|
SET_TZ_AU_AEST,
|
||||||
|
SET_TZ_PACIFIC_NZ,
|
||||||
|
// Power
|
||||||
|
TOGGLE_POWER_SAVE,
|
||||||
|
CALIBRATE_ADC,
|
||||||
|
// Bluetooth
|
||||||
|
TOGGLE_BLUETOOTH,
|
||||||
|
TOGGLE_BLUETOOTH_PAIR_MODE,
|
||||||
|
// Channel
|
||||||
|
TOGGLE_CHANNEL_UPLINK,
|
||||||
|
TOGGLE_CHANNEL_DOWNLINK,
|
||||||
|
TOGGLE_CHANNEL_POSITION,
|
||||||
|
SET_CHANNEL_PRECISION,
|
||||||
|
// Display
|
||||||
|
TOGGLE_DISPLAY_UNITS,
|
||||||
|
// Network
|
||||||
|
TOGGLE_WIFI,
|
||||||
|
// Administration
|
||||||
|
RESET_NODEDB_ALL,
|
||||||
|
RESET_NODEDB_KEEP_FAVORITES,
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NicheGraphics::InkHUD
|
} // namespace NicheGraphics::InkHUD
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,7 @@ class MenuApplet : public SystemApplet, public concurrency::OSThread
|
|||||||
void onRender() override;
|
void onRender() override;
|
||||||
|
|
||||||
void show(Tile *t); // Open the menu, onto a user tile
|
void show(Tile *t); // Open the menu, onto a user tile
|
||||||
|
void setStartPage(MenuPage page);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Drivers::LatchingBacklight *backlight = nullptr; // Convenient access to the backlight singleton
|
Drivers::LatchingBacklight *backlight = nullptr; // Convenient access to the backlight singleton
|
||||||
@@ -56,6 +57,7 @@ class MenuApplet : public SystemApplet, public concurrency::OSThread
|
|||||||
void sendText(NodeNum dest, ChannelIndex channel, const char *message); // Send a text message to mesh
|
void sendText(NodeNum dest, ChannelIndex channel, const char *message); // Send a text message to mesh
|
||||||
void freeCannedMessageResources(); // Clear MenuApplet's canned message processing data
|
void freeCannedMessageResources(); // Clear MenuApplet's canned message processing data
|
||||||
|
|
||||||
|
MenuPage startPageOverride = MenuPage::ROOT;
|
||||||
MenuPage currentPage = MenuPage::ROOT;
|
MenuPage currentPage = MenuPage::ROOT;
|
||||||
MenuPage previousPage = MenuPage::EXIT;
|
MenuPage previousPage = MenuPage::EXIT;
|
||||||
uint8_t cursor = 0; // Which menu item is currently highlighted
|
uint8_t cursor = 0; // Which menu item is currently highlighted
|
||||||
@@ -63,7 +65,15 @@ class MenuApplet : public SystemApplet, public concurrency::OSThread
|
|||||||
|
|
||||||
uint16_t systemInfoPanelHeight = 0; // Need to know before we render
|
uint16_t systemInfoPanelHeight = 0; // Need to know before we render
|
||||||
|
|
||||||
std::vector<MenuItem> items; // MenuItems for the current page. Filled by ShowPage
|
std::vector<MenuItem> items; // MenuItems for the current page. Filled by ShowPage
|
||||||
|
std::vector<std::string> nodeConfigLabels; // Persistent labels for Node Config pages
|
||||||
|
uint8_t selectedChannelIndex = 0; // Currently selected LoRa channel (Node Config → Radio → Channel)
|
||||||
|
bool channelPositionEnabled = false;
|
||||||
|
bool gpsEnabled = false;
|
||||||
|
|
||||||
|
// Recents menu checkbox state (derived from settings.recentlyActiveSeconds)
|
||||||
|
static constexpr uint8_t RECENTS_COUNT = 6;
|
||||||
|
bool recentsSelected[RECENTS_COUNT] = {};
|
||||||
|
|
||||||
// Data for selecting and sending canned messages via the menu
|
// Data for selecting and sending canned messages via the menu
|
||||||
// Placed into a sub-class for organization only
|
// Placed into a sub-class for organization only
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class MenuItem
|
|||||||
MenuAction action = NO_ACTION;
|
MenuAction action = NO_ACTION;
|
||||||
MenuPage nextPage = EXIT;
|
MenuPage nextPage = EXIT;
|
||||||
bool *checkState = nullptr;
|
bool *checkState = nullptr;
|
||||||
|
bool isHeader = false; // Non-selectable section label
|
||||||
|
|
||||||
// Various constructors, depending on the intended function of the item
|
// Various constructors, depending on the intended function of the item
|
||||||
|
|
||||||
@@ -40,6 +41,12 @@ class MenuItem
|
|||||||
: label(label), action(action), nextPage(nextPage), checkState(checkState)
|
: label(label), action(action), nextPage(nextPage), checkState(checkState)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
static MenuItem Header(const char *label)
|
||||||
|
{
|
||||||
|
MenuItem item(label, NO_ACTION, EXIT);
|
||||||
|
item.isHeader = true;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NicheGraphics::InkHUD
|
} // namespace NicheGraphics::InkHUD
|
||||||
|
|||||||
@@ -20,10 +20,27 @@ enum MenuPage : uint8_t {
|
|||||||
SEND,
|
SEND,
|
||||||
CANNEDMESSAGE_RECIPIENT, // Select destination for a canned message
|
CANNEDMESSAGE_RECIPIENT, // Select destination for a canned message
|
||||||
OPTIONS,
|
OPTIONS,
|
||||||
|
NODE_CONFIG,
|
||||||
|
NODE_CONFIG_LORA,
|
||||||
|
NODE_CONFIG_CHANNELS, // List of channels
|
||||||
|
NODE_CONFIG_CHANNEL_DETAIL, // Per-channel options
|
||||||
|
NODE_CONFIG_CHANNEL_PRECISION,
|
||||||
|
NODE_CONFIG_PRESET,
|
||||||
|
NODE_CONFIG_DEVICE,
|
||||||
|
NODE_CONFIG_DEVICE_ROLE,
|
||||||
|
NODE_CONFIG_POWER,
|
||||||
|
NODE_CONFIG_POWER_ADC_CAL,
|
||||||
|
NODE_CONFIG_NETWORK,
|
||||||
|
NODE_CONFIG_DISPLAY,
|
||||||
|
NODE_CONFIG_BLUETOOTH,
|
||||||
|
NODE_CONFIG_POSITION,
|
||||||
|
NODE_CONFIG_ADMIN_RESET,
|
||||||
|
TIMEZONE,
|
||||||
APPLETS,
|
APPLETS,
|
||||||
AUTOSHOW,
|
AUTOSHOW,
|
||||||
RECENTS, // Select length of "recentlyActiveSeconds"
|
RECENTS, // Select length of "recentlyActiveSeconds"
|
||||||
EXIT, // Dismiss the menu applet
|
REGION,
|
||||||
|
EXIT, // Dismiss the menu applet
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NicheGraphics::InkHUD
|
} // namespace NicheGraphics::InkHUD
|
||||||
|
|||||||
@@ -10,34 +10,37 @@ using namespace NicheGraphics;
|
|||||||
|
|
||||||
InkHUD::TipsApplet::TipsApplet()
|
InkHUD::TipsApplet::TipsApplet()
|
||||||
{
|
{
|
||||||
// Decide which tips (if any) should be shown to user after the boot screen
|
bool needsRegion = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
|
||||||
|
|
||||||
|
bool showTutorialTips = (settings->tips.firstBoot || needsRegion);
|
||||||
|
|
||||||
// Welcome screen
|
// Welcome screen
|
||||||
if (settings->tips.firstBoot)
|
if (showTutorialTips)
|
||||||
tipQueue.push_back(Tip::WELCOME);
|
tipQueue.push_back(Tip::WELCOME);
|
||||||
|
|
||||||
// Antenna, region, timezone
|
// Finish setup
|
||||||
// Shown at boot if region not yet set
|
if (needsRegion)
|
||||||
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET)
|
|
||||||
tipQueue.push_back(Tip::FINISH_SETUP);
|
tipQueue.push_back(Tip::FINISH_SETUP);
|
||||||
|
|
||||||
|
// Using the UI
|
||||||
|
if (showTutorialTips) {
|
||||||
|
tipQueue.push_back(Tip::CUSTOMIZATION);
|
||||||
|
tipQueue.push_back(Tip::BUTTONS);
|
||||||
|
}
|
||||||
|
|
||||||
// Shutdown info
|
// Shutdown info
|
||||||
// Shown until user performs one valid shutdown
|
// Shown until user performs one valid shutdown
|
||||||
if (!settings->tips.safeShutdownSeen)
|
if (!settings->tips.safeShutdownSeen)
|
||||||
tipQueue.push_back(Tip::SAFE_SHUTDOWN);
|
tipQueue.push_back(Tip::SAFE_SHUTDOWN);
|
||||||
|
|
||||||
// Using the UI
|
|
||||||
if (settings->tips.firstBoot) {
|
|
||||||
tipQueue.push_back(Tip::CUSTOMIZATION);
|
|
||||||
tipQueue.push_back(Tip::BUTTONS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Catch an incorrect attempt at rotating display
|
// Catch an incorrect attempt at rotating display
|
||||||
if (config.display.flip_screen)
|
if (config.display.flip_screen)
|
||||||
tipQueue.push_back(Tip::ROTATION);
|
tipQueue.push_back(Tip::ROTATION);
|
||||||
|
|
||||||
// Applet is foreground immediately at boot, but is obscured by LogoApplet, which is also foreground
|
// Region picker
|
||||||
// LogoApplet can be considered to have a higher Z-index, because it is placed before TipsApplet in the systemApplets vector
|
if (needsRegion)
|
||||||
|
tipQueue.push_back(Tip::PICK_REGION);
|
||||||
|
|
||||||
if (!tipQueue.empty())
|
if (!tipQueue.empty())
|
||||||
bringToForeground();
|
bringToForeground();
|
||||||
}
|
}
|
||||||
@@ -51,81 +54,109 @@ void InkHUD::TipsApplet::onRender()
|
|||||||
|
|
||||||
case Tip::FINISH_SETUP: {
|
case Tip::FINISH_SETUP: {
|
||||||
setFont(fontMedium);
|
setFont(fontMedium);
|
||||||
printAt(0, 0, "Tip: Finish Setup");
|
const char *title = "Tip: Finish Setup";
|
||||||
|
uint16_t h = getWrappedTextHeight(0, width(), title);
|
||||||
|
printWrapped(0, 0, width(), title);
|
||||||
|
|
||||||
setFont(fontSmall);
|
setFont(fontSmall);
|
||||||
int16_t cursorY = fontMedium.lineHeight() * 1.5;
|
int16_t cursorY = h + fontSmall.lineHeight();
|
||||||
printAt(0, cursorY, "- connect antenna");
|
|
||||||
|
|
||||||
cursorY += fontSmall.lineHeight() * 1.2;
|
auto drawBullet = [&](const char *text) {
|
||||||
printAt(0, cursorY, "- connect a client app");
|
uint16_t bh = getWrappedTextHeight(0, width(), text);
|
||||||
|
printWrapped(0, cursorY, width(), text);
|
||||||
|
cursorY += bh + (fontSmall.lineHeight() / 3);
|
||||||
|
};
|
||||||
|
|
||||||
// Only if region not set
|
drawBullet("- connect antenna");
|
||||||
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
drawBullet("- connect a client app");
|
||||||
cursorY += fontSmall.lineHeight() * 1.2;
|
|
||||||
printAt(0, cursorY, "- set region");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only if tz not set
|
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET)
|
||||||
if (!(*config.device.tzdef && config.device.tzdef[0] != 0)) {
|
drawBullet("- set region");
|
||||||
cursorY += fontSmall.lineHeight() * 1.2;
|
|
||||||
printAt(0, cursorY, "- set timezone");
|
|
||||||
}
|
|
||||||
|
|
||||||
cursorY += fontSmall.lineHeight() * 1.5;
|
if (!(*config.device.tzdef && config.device.tzdef[0] != 0))
|
||||||
printAt(0, cursorY, "More info at meshtastic.org");
|
drawBullet("- set timezone");
|
||||||
|
|
||||||
|
cursorY += fontSmall.lineHeight() / 2;
|
||||||
|
drawBullet("More info at meshtastic.org");
|
||||||
|
|
||||||
setFont(fontSmall);
|
|
||||||
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
|
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case Tip::PICK_REGION: {
|
||||||
|
setFont(fontMedium);
|
||||||
|
printAt(0, 0, "Set Region");
|
||||||
|
|
||||||
|
setFont(fontSmall);
|
||||||
|
printWrapped(0, fontMedium.lineHeight() * 1.5, width(), "Please select your LoRa region to complete setup.");
|
||||||
|
|
||||||
|
printAt(0, Y(1.0), "Press button to choose", LEFT, BOTTOM);
|
||||||
|
} break;
|
||||||
|
|
||||||
case Tip::SAFE_SHUTDOWN: {
|
case Tip::SAFE_SHUTDOWN: {
|
||||||
setFont(fontMedium);
|
setFont(fontMedium);
|
||||||
printAt(0, 0, "Tip: Shutdown");
|
|
||||||
|
const char *title = "Tip: Shutdown";
|
||||||
|
uint16_t h = getWrappedTextHeight(0, width(), title);
|
||||||
|
printWrapped(0, 0, width(), title);
|
||||||
|
|
||||||
setFont(fontSmall);
|
setFont(fontSmall);
|
||||||
std::string shutdown;
|
int16_t cursorY = h + fontSmall.lineHeight();
|
||||||
shutdown += "Before removing power, please shut down from InkHUD menu, or a client app. \n";
|
|
||||||
shutdown += "\n";
|
const char *body = "Before removing power, please shut down from InkHUD menu, or a client app.\n\n"
|
||||||
shutdown += "This ensures data is saved.";
|
"This ensures data is saved.";
|
||||||
printWrapped(0, fontMedium.lineHeight() * 1.5, width(), shutdown);
|
|
||||||
|
uint16_t bodyH = getWrappedTextHeight(0, width(), body);
|
||||||
|
printWrapped(0, cursorY, width(), body);
|
||||||
|
cursorY += bodyH + (fontSmall.lineHeight() / 2);
|
||||||
|
|
||||||
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
|
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case Tip::CUSTOMIZATION: {
|
case Tip::CUSTOMIZATION: {
|
||||||
setFont(fontMedium);
|
setFont(fontMedium);
|
||||||
printAt(0, 0, "Tip: Customization");
|
|
||||||
|
const char *title = "Tip: Customization";
|
||||||
|
uint16_t h = getWrappedTextHeight(0, width(), title);
|
||||||
|
printWrapped(0, 0, width(), title);
|
||||||
|
|
||||||
setFont(fontSmall);
|
setFont(fontSmall);
|
||||||
printWrapped(0, fontMedium.lineHeight() * 1.5, width(),
|
int16_t cursorY = h + fontSmall.lineHeight();
|
||||||
"Configure & control display with the InkHUD menu. Optional features, layout, rotation, and more.");
|
|
||||||
|
const char *body = "Configure & control display with the InkHUD menu. "
|
||||||
|
"Optional features, layout, rotation, and more.";
|
||||||
|
|
||||||
|
uint16_t bodyH = getWrappedTextHeight(0, width(), body);
|
||||||
|
printWrapped(0, cursorY, width(), body);
|
||||||
|
cursorY += bodyH + (fontSmall.lineHeight() / 2);
|
||||||
|
|
||||||
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
|
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case Tip::BUTTONS: {
|
case Tip::BUTTONS: {
|
||||||
setFont(fontMedium);
|
setFont(fontMedium);
|
||||||
printAt(0, 0, "Tip: Buttons");
|
|
||||||
|
const char *title = "Tip: Buttons";
|
||||||
|
uint16_t h = getWrappedTextHeight(0, width(), title);
|
||||||
|
printWrapped(0, 0, width(), title);
|
||||||
|
|
||||||
setFont(fontSmall);
|
setFont(fontSmall);
|
||||||
int16_t cursorY = fontMedium.lineHeight() * 1.5;
|
int16_t cursorY = h + fontSmall.lineHeight();
|
||||||
|
|
||||||
|
auto drawBullet = [&](const char *text) {
|
||||||
|
uint16_t bh = getWrappedTextHeight(0, width(), text);
|
||||||
|
printWrapped(0, cursorY, width(), text);
|
||||||
|
cursorY += bh + (fontSmall.lineHeight() / 3);
|
||||||
|
};
|
||||||
|
|
||||||
if (!settings->joystick.enabled) {
|
if (!settings->joystick.enabled) {
|
||||||
printAt(0, cursorY, "User Button");
|
drawBullet("User Button");
|
||||||
cursorY += fontSmall.lineHeight() * 1.2;
|
drawBullet("- short press: next");
|
||||||
printAt(0, cursorY, "- short press: next");
|
drawBullet("- long press: select or open menu");
|
||||||
cursorY += fontSmall.lineHeight() * 1.2;
|
|
||||||
printAt(0, cursorY, "- long press: select / open menu");
|
|
||||||
} else {
|
} else {
|
||||||
printAt(0, cursorY, "Joystick");
|
drawBullet("Joystick");
|
||||||
cursorY += fontSmall.lineHeight() * 1.2;
|
drawBullet("- press: open menu or select");
|
||||||
printAt(0, cursorY, "- open menu / select");
|
drawBullet("Exit Button");
|
||||||
cursorY += fontSmall.lineHeight() * 1.5;
|
drawBullet("- press: switch tile or close menu");
|
||||||
printAt(0, cursorY, "Exit Button");
|
|
||||||
cursorY += fontSmall.lineHeight() * 1.2;
|
|
||||||
printAt(0, cursorY, "- switch tile / close menu");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
|
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
|
||||||
@@ -133,12 +164,21 @@ void InkHUD::TipsApplet::onRender()
|
|||||||
|
|
||||||
case Tip::ROTATION: {
|
case Tip::ROTATION: {
|
||||||
setFont(fontMedium);
|
setFont(fontMedium);
|
||||||
printAt(0, 0, "Tip: Rotation");
|
|
||||||
|
const char *title = "Tip: Rotation";
|
||||||
|
uint16_t h = getWrappedTextHeight(0, width(), title);
|
||||||
|
printWrapped(0, 0, width(), title);
|
||||||
|
|
||||||
setFont(fontSmall);
|
setFont(fontSmall);
|
||||||
if (!settings->joystick.enabled) {
|
if (!settings->joystick.enabled) {
|
||||||
printWrapped(0, fontMedium.lineHeight() * 1.5, width(),
|
int16_t cursorY = h + fontSmall.lineHeight();
|
||||||
"To rotate the display, use the InkHUD menu. Long-press the user button > Options > Rotate.");
|
|
||||||
|
const char *body = "To rotate the display, use the InkHUD menu. "
|
||||||
|
"Long-press the user button > Options > Rotate.";
|
||||||
|
|
||||||
|
uint16_t bh = getWrappedTextHeight(0, width(), body);
|
||||||
|
printWrapped(0, cursorY, width(), body);
|
||||||
|
cursorY += bh + (fontSmall.lineHeight() / 2);
|
||||||
} else {
|
} else {
|
||||||
printWrapped(0, fontMedium.lineHeight() * 1.5, width(),
|
printWrapped(0, fontMedium.lineHeight() * 1.5, width(),
|
||||||
"To rotate the display, use the InkHUD menu. Press the user button > Options > Rotate.");
|
"To rotate the display, use the InkHUD menu. Press the user button > Options > Rotate.");
|
||||||
@@ -159,12 +199,15 @@ void InkHUD::TipsApplet::renderWelcome()
|
|||||||
{
|
{
|
||||||
uint16_t padW = X(0.05);
|
uint16_t padW = X(0.05);
|
||||||
|
|
||||||
|
// Detect portrait orientation
|
||||||
|
bool portrait = height() > width();
|
||||||
|
|
||||||
// Block 1 - logo & title
|
// Block 1 - logo & title
|
||||||
// ========================
|
// ========================
|
||||||
|
|
||||||
// Logo size
|
// Logo size
|
||||||
uint16_t logoWLimit = X(0.3);
|
uint16_t logoWLimit = portrait ? X(0.5) : X(0.3);
|
||||||
uint16_t logoHLimit = Y(0.3);
|
uint16_t logoHLimit = portrait ? Y(0.25) : Y(0.3);
|
||||||
uint16_t logoW = getLogoWidth(logoWLimit, logoHLimit);
|
uint16_t logoW = getLogoWidth(logoWLimit, logoHLimit);
|
||||||
uint16_t logoH = getLogoHeight(logoWLimit, logoHLimit);
|
uint16_t logoH = getLogoHeight(logoWLimit, logoHLimit);
|
||||||
|
|
||||||
@@ -177,7 +220,7 @@ void InkHUD::TipsApplet::renderWelcome()
|
|||||||
|
|
||||||
// Center the block
|
// Center the block
|
||||||
// Desired effect: equal margin from display edge for logo left and title right
|
// Desired effect: equal margin from display edge for logo left and title right
|
||||||
int16_t block1Y = Y(0.3);
|
int16_t block1Y = portrait ? Y(0.2) : Y(0.3);
|
||||||
int16_t block1CX = X(0.5) + (logoW / 2) - (titleW / 2);
|
int16_t block1CX = X(0.5) + (logoW / 2) - (titleW / 2);
|
||||||
int16_t logoCX = block1CX - (logoW / 2) - (padW / 2);
|
int16_t logoCX = block1CX - (logoW / 2) - (padW / 2);
|
||||||
int16_t titleCX = block1CX + (titleW / 2) + (padW / 2);
|
int16_t titleCX = block1CX + (titleW / 2) + (padW / 2);
|
||||||
@@ -192,7 +235,7 @@ void InkHUD::TipsApplet::renderWelcome()
|
|||||||
std::string subtitle = "InkHUD";
|
std::string subtitle = "InkHUD";
|
||||||
if (width() >= 200)
|
if (width() >= 200)
|
||||||
subtitle += " - A Heads-Up Display"; // Future proofing: narrower for tiny display
|
subtitle += " - A Heads-Up Display"; // Future proofing: narrower for tiny display
|
||||||
printAt(X(0.5), Y(0.6), subtitle, CENTER, MIDDLE);
|
printAt(X(0.5), portrait ? Y(0.45) : Y(0.6), subtitle, CENTER, MIDDLE);
|
||||||
|
|
||||||
// Block 3 - press to continue
|
// Block 3 - press to continue
|
||||||
// ============================
|
// ============================
|
||||||
@@ -224,26 +267,37 @@ void InkHUD::TipsApplet::onBackground()
|
|||||||
// While our SystemApplet::handleInput flag is true
|
// While our SystemApplet::handleInput flag is true
|
||||||
void InkHUD::TipsApplet::onButtonShortPress()
|
void InkHUD::TipsApplet::onButtonShortPress()
|
||||||
{
|
{
|
||||||
|
bool needsRegion = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
|
||||||
|
// If we're prompting the user to pick a region, hand off to the menu
|
||||||
|
if (!tipQueue.empty() && tipQueue.front() == Tip::PICK_REGION) {
|
||||||
|
tipQueue.pop_front();
|
||||||
|
|
||||||
|
// Signal InkHUD to open the menu on Region page
|
||||||
|
inkhud->forceRegionMenu = true;
|
||||||
|
|
||||||
|
// Close tips and open menu
|
||||||
|
sendToBackground();
|
||||||
|
inkhud->openMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Consume current tip
|
||||||
tipQueue.pop_front();
|
tipQueue.pop_front();
|
||||||
|
|
||||||
// All tips done
|
// All tips done
|
||||||
if (tipQueue.empty()) {
|
if (tipQueue.empty()) {
|
||||||
// Record that user has now seen the "tutorial" set of tips
|
// Record that user has now seen the "tutorial" set of tips
|
||||||
// Don't show them on subsequent boots
|
// Don't show them on subsequent boots
|
||||||
if (settings->tips.firstBoot) {
|
if (settings->tips.firstBoot && !needsRegion) {
|
||||||
settings->tips.firstBoot = false;
|
settings->tips.firstBoot = false;
|
||||||
inkhud->persistence->saveSettings();
|
inkhud->persistence->saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close applet, and full refresh to clean the screen
|
// Close applet and clean the screen
|
||||||
// Need to force update, because our request would be ignored otherwise, as we are now background
|
|
||||||
sendToBackground();
|
sendToBackground();
|
||||||
inkhud->forceUpdate(EInk::UpdateTypes::FULL);
|
inkhud->forceUpdate(EInk::UpdateTypes::FULL);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// More tips left
|
|
||||||
else
|
|
||||||
requestUpdate();
|
requestUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions the same as the user button in this instance
|
// Functions the same as the user button in this instance
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class TipsApplet : public SystemApplet
|
|||||||
enum class Tip {
|
enum class Tip {
|
||||||
WELCOME,
|
WELCOME,
|
||||||
FINISH_SETUP,
|
FINISH_SETUP,
|
||||||
|
PICK_REGION,
|
||||||
SAFE_SHUTDOWN,
|
SAFE_SHUTDOWN,
|
||||||
CUSTOMIZATION,
|
CUSTOMIZATION,
|
||||||
BUTTONS,
|
BUTTONS,
|
||||||
|
|||||||
@@ -276,6 +276,15 @@ int InkHUD::Events::beforeDeepSleep(void *unused)
|
|||||||
return 0; // We agree: deep sleep now
|
return 0; // We agree: deep sleep now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display an intermediate screen while configuration changes are applied
|
||||||
|
void InkHUD::Events::applyingChanges()
|
||||||
|
{
|
||||||
|
// Bring the logo applet forward with a temporary message
|
||||||
|
for (SystemApplet *sa : inkhud->systemApplets) {
|
||||||
|
sa->onApplyingChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Callback for rebootObserver
|
// Callback for rebootObserver
|
||||||
// Same as shutdown, without drawing the logoApplet
|
// Same as shutdown, without drawing the logoApplet
|
||||||
// Makes sure we don't lose message history / InkHUD config
|
// Makes sure we don't lose message history / InkHUD config
|
||||||
|
|||||||
@@ -29,12 +29,13 @@ class Events
|
|||||||
|
|
||||||
void onButtonShort(); // User button: short press
|
void onButtonShort(); // User button: short press
|
||||||
void onButtonLong(); // User button: long press
|
void onButtonLong(); // User button: long press
|
||||||
void onExitShort(); // Exit button: short press
|
void applyingChanges();
|
||||||
void onExitLong(); // Exit button: long press
|
void onExitShort(); // Exit button: short press
|
||||||
void onNavUp(); // Navigate up
|
void onExitLong(); // Exit button: long press
|
||||||
void onNavDown(); // Navigate down
|
void onNavUp(); // Navigate up
|
||||||
void onNavLeft(); // Navigate left
|
void onNavDown(); // Navigate down
|
||||||
void onNavRight(); // Navigate right
|
void onNavLeft(); // Navigate left
|
||||||
|
void onNavRight(); // Navigate right
|
||||||
|
|
||||||
int beforeDeepSleep(void *unused); // Prepare for shutdown
|
int beforeDeepSleep(void *unused); // Prepare for shutdown
|
||||||
int beforeReboot(void *unused); // Prepare for reboot
|
int beforeReboot(void *unused); // Prepare for reboot
|
||||||
|
|||||||
@@ -53,6 +53,13 @@ void InkHUD::InkHUD::addApplet(const char *name, Applet *a, bool defaultActive,
|
|||||||
windowManager->addApplet(name, a, defaultActive, defaultAutoshow, onTile);
|
windowManager->addApplet(name, a, defaultActive, defaultAutoshow, onTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InkHUD::InkHUD::notifyApplyingChanges()
|
||||||
|
{
|
||||||
|
if (events) {
|
||||||
|
events->applyingChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Start InkHUD!
|
// Start InkHUD!
|
||||||
// Call this only after you have configured InkHUD
|
// Call this only after you have configured InkHUD
|
||||||
void InkHUD::InkHUD::begin()
|
void InkHUD::InkHUD::begin()
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class InkHUD
|
|||||||
void setDriver(Drivers::EInk *driver);
|
void setDriver(Drivers::EInk *driver);
|
||||||
void setDisplayResilience(uint8_t fastPerFull = 5, float stressMultiplier = 2.0);
|
void setDisplayResilience(uint8_t fastPerFull = 5, float stressMultiplier = 2.0);
|
||||||
void addApplet(const char *name, Applet *a, bool defaultActive = false, bool defaultAutoshow = false, uint8_t onTile = -1);
|
void addApplet(const char *name, Applet *a, bool defaultActive = false, bool defaultAutoshow = false, uint8_t onTile = -1);
|
||||||
|
void notifyApplyingChanges();
|
||||||
|
|
||||||
void begin();
|
void begin();
|
||||||
|
|
||||||
@@ -76,6 +77,9 @@ class InkHUD
|
|||||||
void rotateJoystick(uint8_t angle = 1); // rotate 90 deg by default
|
void rotateJoystick(uint8_t angle = 1); // rotate 90 deg by default
|
||||||
void toggleBatteryIcon();
|
void toggleBatteryIcon();
|
||||||
|
|
||||||
|
// Used by TipsApplet to force menu to start on Region selection
|
||||||
|
bool forceRegionMenu = false;
|
||||||
|
|
||||||
// Updating the display
|
// Updating the display
|
||||||
// - called by various InkHUD components
|
// - called by various InkHUD components
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class SystemApplet : public Applet
|
|||||||
bool lockRequests = false; // - prevent other applets from triggering display updates
|
bool lockRequests = false; // - prevent other applets from triggering display updates
|
||||||
|
|
||||||
virtual void onReboot() { onShutdown(); } // - handle reboot specially
|
virtual void onReboot() { onShutdown(); } // - handle reboot specially
|
||||||
|
virtual void onApplyingChanges() {}
|
||||||
|
|
||||||
// Other system applets may take precedence over our own system applet though
|
// Other system applets may take precedence over our own system applet though
|
||||||
// The order an applet is passed to WindowManager::addSystemApplet determines this hierarchy (added earlier = higher rank)
|
// The order an applet is passed to WindowManager::addSystemApplet determines this hierarchy (added earlier = higher rank)
|
||||||
|
|||||||
43
src/main.cpp
43
src/main.cpp
@@ -105,6 +105,43 @@ NRF52Bluetooth *nrf52Bluetooth = nullptr;
|
|||||||
#include <string>
|
#include <string>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
#ifdef DEBUG_PARTITION_TABLE
|
||||||
|
#include "esp_partition.h"
|
||||||
|
|
||||||
|
void printPartitionTable()
|
||||||
|
{
|
||||||
|
printf("\n--- Partition Table ---\n");
|
||||||
|
// Print Column Headers
|
||||||
|
printf("| %-16s | %-4s | %-7s | %-10s | %-10s |\n", "Label", "Type", "Subtype", "Offset", "Size");
|
||||||
|
printf("|------------------|------|---------|------------|------------|\n");
|
||||||
|
|
||||||
|
// Create an iterator to find ALL partitions (Type ANY, Subtype ANY)
|
||||||
|
esp_partition_iterator_t it = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
|
||||||
|
|
||||||
|
// Loop through the iterator
|
||||||
|
if (it != NULL) {
|
||||||
|
do {
|
||||||
|
const esp_partition_t *part = esp_partition_get(it);
|
||||||
|
|
||||||
|
// Print details: Label, Type (Hex), Subtype (Hex), Offset (Hex), Size (Hex)
|
||||||
|
printf("| %-16s | 0x%02x | 0x%02x | 0x%08x | 0x%08x |\n", part->label, part->type, part->subtype, part->address,
|
||||||
|
part->size);
|
||||||
|
|
||||||
|
// Move to next partition
|
||||||
|
it = esp_partition_next(it);
|
||||||
|
} while (it != NULL);
|
||||||
|
|
||||||
|
// Release the iterator memory
|
||||||
|
esp_partition_iterator_release(it);
|
||||||
|
} else {
|
||||||
|
printf("No partitions found.\n");
|
||||||
|
}
|
||||||
|
printf("-----------------------\n");
|
||||||
|
}
|
||||||
|
#endif // DEBUG_PARTITION_TABLE
|
||||||
|
#endif // ARCH_ESP32
|
||||||
|
|
||||||
#if HAS_BUTTON || defined(ARCH_PORTDUINO)
|
#if HAS_BUTTON || defined(ARCH_PORTDUINO)
|
||||||
#include "input/ButtonThread.h"
|
#include "input/ButtonThread.h"
|
||||||
|
|
||||||
@@ -648,7 +685,11 @@ void setup()
|
|||||||
sensor_detected = true;
|
sensor_detected = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
#ifdef DEBUG_PARTITION_TABLE
|
||||||
|
printPartitionTable();
|
||||||
|
#endif
|
||||||
|
#endif // ARCH_ESP32
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// Don't init display if we don't have one or we are waking headless due to a timer event
|
// Don't init display if we don't have one or we are waking headless due to a timer event
|
||||||
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER) {
|
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER) {
|
||||||
|
|||||||
@@ -666,18 +666,24 @@ void RadioInterface::limitPower(int8_t loraMaxPower)
|
|||||||
power = maxPower;
|
power = maxPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NUM_PA_POINTS
|
#ifdef ARCH_PORTDUINO
|
||||||
if (TX_GAIN_LORA > 0 && !devicestate.owner.is_licensed) {
|
size_t num_pa_points = portduino_config.num_pa_points;
|
||||||
LOG_INFO("Requested Tx power: %d dBm; Device LoRa Tx gain: %d dB", power, TX_GAIN_LORA);
|
const uint16_t *tx_gain = portduino_config.tx_gain_lora;
|
||||||
power -= TX_GAIN_LORA;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
if (!devicestate.owner.is_licensed) {
|
size_t num_pa_points = NUM_PA_POINTS;
|
||||||
|
const uint16_t tx_gain[NUM_PA_POINTS] = {TX_GAIN_LORA};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (num_pa_points == 1) {
|
||||||
|
if (tx_gain[0] > 0 && !devicestate.owner.is_licensed) {
|
||||||
|
LOG_INFO("Requested Tx power: %d dBm; Device LoRa Tx gain: %d dB", power, tx_gain[0]);
|
||||||
|
power -= tx_gain[0];
|
||||||
|
}
|
||||||
|
} else if (!devicestate.owner.is_licensed) {
|
||||||
// we have an array of PA gain values. Find the highest power setting that works.
|
// we have an array of PA gain values. Find the highest power setting that works.
|
||||||
const uint16_t tx_gain[NUM_PA_POINTS] = {TX_GAIN_LORA};
|
for (int radio_dbm = 0; radio_dbm < num_pa_points; radio_dbm++) {
|
||||||
for (int radio_dbm = 0; radio_dbm < NUM_PA_POINTS; radio_dbm++) {
|
|
||||||
if (((radio_dbm + tx_gain[radio_dbm]) > power) ||
|
if (((radio_dbm + tx_gain[radio_dbm]) > power) ||
|
||||||
((radio_dbm == (NUM_PA_POINTS - 1)) && ((radio_dbm + tx_gain[radio_dbm]) <= power))) {
|
((radio_dbm == (num_pa_points - 1)) && ((radio_dbm + tx_gain[radio_dbm]) <= power))) {
|
||||||
// we've exceeded the power limit, or hit the max we can do
|
// we've exceeded the power limit, or hit the max we can do
|
||||||
LOG_INFO("Requested Tx power: %d dBm; Device LoRa Tx gain: %d dB", power, tx_gain[radio_dbm]);
|
LOG_INFO("Requested Tx power: %d dBm; Device LoRa Tx gain: %d dB", power, tx_gain[radio_dbm]);
|
||||||
power -= tx_gain[radio_dbm];
|
power -= tx_gain[radio_dbm];
|
||||||
@@ -685,7 +691,7 @@ void RadioInterface::limitPower(int8_t loraMaxPower)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (power > loraMaxPower) // Clamp power to maximum defined level
|
if (power > loraMaxPower) // Clamp power to maximum defined level
|
||||||
power = loraMaxPower;
|
power = loraMaxPower;
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ typedef enum _meshtastic_AdminMessage_ModuleConfigType {
|
|||||||
/* TODO: REPLACE */
|
/* TODO: REPLACE */
|
||||||
meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG = 11,
|
meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG = 11,
|
||||||
/* TODO: REPLACE */
|
/* TODO: REPLACE */
|
||||||
meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG = 12
|
meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG = 12,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
meshtastic_AdminMessage_ModuleConfigType_STATUSMESSAGE_CONFIG = 13
|
||||||
} meshtastic_AdminMessage_ModuleConfigType;
|
} meshtastic_AdminMessage_ModuleConfigType;
|
||||||
|
|
||||||
typedef enum _meshtastic_AdminMessage_BackupLocation {
|
typedef enum _meshtastic_AdminMessage_BackupLocation {
|
||||||
@@ -323,8 +325,8 @@ extern "C" {
|
|||||||
#define _meshtastic_AdminMessage_ConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ConfigType)(meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG+1))
|
#define _meshtastic_AdminMessage_ConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ConfigType)(meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG+1))
|
||||||
|
|
||||||
#define _meshtastic_AdminMessage_ModuleConfigType_MIN meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG
|
#define _meshtastic_AdminMessage_ModuleConfigType_MIN meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG
|
||||||
#define _meshtastic_AdminMessage_ModuleConfigType_MAX meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG
|
#define _meshtastic_AdminMessage_ModuleConfigType_MAX meshtastic_AdminMessage_ModuleConfigType_STATUSMESSAGE_CONFIG
|
||||||
#define _meshtastic_AdminMessage_ModuleConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ModuleConfigType)(meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG+1))
|
#define _meshtastic_AdminMessage_ModuleConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ModuleConfigType)(meshtastic_AdminMessage_ModuleConfigType_STATUSMESSAGE_CONFIG+1))
|
||||||
|
|
||||||
#define _meshtastic_AdminMessage_BackupLocation_MIN meshtastic_AdminMessage_BackupLocation_FLASH
|
#define _meshtastic_AdminMessage_BackupLocation_MIN meshtastic_AdminMessage_BackupLocation_FLASH
|
||||||
#define _meshtastic_AdminMessage_BackupLocation_MAX meshtastic_AdminMessage_BackupLocation_SD
|
#define _meshtastic_AdminMessage_BackupLocation_MAX meshtastic_AdminMessage_BackupLocation_SD
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ extern const pb_msgdesc_t meshtastic_BackupPreferences_msg;
|
|||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
/* meshtastic_NodeDatabase_size depends on runtime parameters */
|
/* meshtastic_NodeDatabase_size depends on runtime parameters */
|
||||||
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size
|
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size
|
||||||
#define meshtastic_BackupPreferences_size 2279
|
#define meshtastic_BackupPreferences_size 2362
|
||||||
#define meshtastic_ChannelFile_size 718
|
#define meshtastic_ChannelFile_size 718
|
||||||
#define meshtastic_DeviceState_size 1737
|
#define meshtastic_DeviceState_size 1737
|
||||||
#define meshtastic_NodeInfoLite_size 196
|
#define meshtastic_NodeInfoLite_size 196
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ typedef struct _meshtastic_LocalModuleConfig {
|
|||||||
/* Paxcounter Config */
|
/* Paxcounter Config */
|
||||||
bool has_paxcounter;
|
bool has_paxcounter;
|
||||||
meshtastic_ModuleConfig_PaxcounterConfig paxcounter;
|
meshtastic_ModuleConfig_PaxcounterConfig paxcounter;
|
||||||
|
/* StatusMessage Config */
|
||||||
|
bool has_statusmessage;
|
||||||
|
meshtastic_ModuleConfig_StatusMessageConfig statusmessage;
|
||||||
} meshtastic_LocalModuleConfig;
|
} meshtastic_LocalModuleConfig;
|
||||||
|
|
||||||
|
|
||||||
@@ -96,9 +99,9 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_LocalConfig_init_default {false, meshtastic_Config_DeviceConfig_init_default, false, meshtastic_Config_PositionConfig_init_default, false, meshtastic_Config_PowerConfig_init_default, false, meshtastic_Config_NetworkConfig_init_default, false, meshtastic_Config_DisplayConfig_init_default, false, meshtastic_Config_LoRaConfig_init_default, false, meshtastic_Config_BluetoothConfig_init_default, 0, false, meshtastic_Config_SecurityConfig_init_default}
|
#define meshtastic_LocalConfig_init_default {false, meshtastic_Config_DeviceConfig_init_default, false, meshtastic_Config_PositionConfig_init_default, false, meshtastic_Config_PowerConfig_init_default, false, meshtastic_Config_NetworkConfig_init_default, false, meshtastic_Config_DisplayConfig_init_default, false, meshtastic_Config_LoRaConfig_init_default, false, meshtastic_Config_BluetoothConfig_init_default, 0, false, meshtastic_Config_SecurityConfig_init_default}
|
||||||
#define meshtastic_LocalModuleConfig_init_default {false, meshtastic_ModuleConfig_MQTTConfig_init_default, false, meshtastic_ModuleConfig_SerialConfig_init_default, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_default, false, meshtastic_ModuleConfig_StoreForwardConfig_init_default, false, meshtastic_ModuleConfig_RangeTestConfig_init_default, false, meshtastic_ModuleConfig_TelemetryConfig_init_default, false, meshtastic_ModuleConfig_CannedMessageConfig_init_default, 0, false, meshtastic_ModuleConfig_AudioConfig_init_default, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_default, false, meshtastic_ModuleConfig_NeighborInfoConfig_init_default, false, meshtastic_ModuleConfig_AmbientLightingConfig_init_default, false, meshtastic_ModuleConfig_DetectionSensorConfig_init_default, false, meshtastic_ModuleConfig_PaxcounterConfig_init_default}
|
#define meshtastic_LocalModuleConfig_init_default {false, meshtastic_ModuleConfig_MQTTConfig_init_default, false, meshtastic_ModuleConfig_SerialConfig_init_default, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_default, false, meshtastic_ModuleConfig_StoreForwardConfig_init_default, false, meshtastic_ModuleConfig_RangeTestConfig_init_default, false, meshtastic_ModuleConfig_TelemetryConfig_init_default, false, meshtastic_ModuleConfig_CannedMessageConfig_init_default, 0, false, meshtastic_ModuleConfig_AudioConfig_init_default, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_default, false, meshtastic_ModuleConfig_NeighborInfoConfig_init_default, false, meshtastic_ModuleConfig_AmbientLightingConfig_init_default, false, meshtastic_ModuleConfig_DetectionSensorConfig_init_default, false, meshtastic_ModuleConfig_PaxcounterConfig_init_default, false, meshtastic_ModuleConfig_StatusMessageConfig_init_default}
|
||||||
#define meshtastic_LocalConfig_init_zero {false, meshtastic_Config_DeviceConfig_init_zero, false, meshtastic_Config_PositionConfig_init_zero, false, meshtastic_Config_PowerConfig_init_zero, false, meshtastic_Config_NetworkConfig_init_zero, false, meshtastic_Config_DisplayConfig_init_zero, false, meshtastic_Config_LoRaConfig_init_zero, false, meshtastic_Config_BluetoothConfig_init_zero, 0, false, meshtastic_Config_SecurityConfig_init_zero}
|
#define meshtastic_LocalConfig_init_zero {false, meshtastic_Config_DeviceConfig_init_zero, false, meshtastic_Config_PositionConfig_init_zero, false, meshtastic_Config_PowerConfig_init_zero, false, meshtastic_Config_NetworkConfig_init_zero, false, meshtastic_Config_DisplayConfig_init_zero, false, meshtastic_Config_LoRaConfig_init_zero, false, meshtastic_Config_BluetoothConfig_init_zero, 0, false, meshtastic_Config_SecurityConfig_init_zero}
|
||||||
#define meshtastic_LocalModuleConfig_init_zero {false, meshtastic_ModuleConfig_MQTTConfig_init_zero, false, meshtastic_ModuleConfig_SerialConfig_init_zero, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero, false, meshtastic_ModuleConfig_StoreForwardConfig_init_zero, false, meshtastic_ModuleConfig_RangeTestConfig_init_zero, false, meshtastic_ModuleConfig_TelemetryConfig_init_zero, false, meshtastic_ModuleConfig_CannedMessageConfig_init_zero, 0, false, meshtastic_ModuleConfig_AudioConfig_init_zero, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero, false, meshtastic_ModuleConfig_NeighborInfoConfig_init_zero, false, meshtastic_ModuleConfig_AmbientLightingConfig_init_zero, false, meshtastic_ModuleConfig_DetectionSensorConfig_init_zero, false, meshtastic_ModuleConfig_PaxcounterConfig_init_zero}
|
#define meshtastic_LocalModuleConfig_init_zero {false, meshtastic_ModuleConfig_MQTTConfig_init_zero, false, meshtastic_ModuleConfig_SerialConfig_init_zero, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero, false, meshtastic_ModuleConfig_StoreForwardConfig_init_zero, false, meshtastic_ModuleConfig_RangeTestConfig_init_zero, false, meshtastic_ModuleConfig_TelemetryConfig_init_zero, false, meshtastic_ModuleConfig_CannedMessageConfig_init_zero, 0, false, meshtastic_ModuleConfig_AudioConfig_init_zero, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero, false, meshtastic_ModuleConfig_NeighborInfoConfig_init_zero, false, meshtastic_ModuleConfig_AmbientLightingConfig_init_zero, false, meshtastic_ModuleConfig_DetectionSensorConfig_init_zero, false, meshtastic_ModuleConfig_PaxcounterConfig_init_zero, false, meshtastic_ModuleConfig_StatusMessageConfig_init_zero}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_LocalConfig_device_tag 1
|
#define meshtastic_LocalConfig_device_tag 1
|
||||||
@@ -124,6 +127,7 @@ extern "C" {
|
|||||||
#define meshtastic_LocalModuleConfig_ambient_lighting_tag 12
|
#define meshtastic_LocalModuleConfig_ambient_lighting_tag 12
|
||||||
#define meshtastic_LocalModuleConfig_detection_sensor_tag 13
|
#define meshtastic_LocalModuleConfig_detection_sensor_tag 13
|
||||||
#define meshtastic_LocalModuleConfig_paxcounter_tag 14
|
#define meshtastic_LocalModuleConfig_paxcounter_tag 14
|
||||||
|
#define meshtastic_LocalModuleConfig_statusmessage_tag 15
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define meshtastic_LocalConfig_FIELDLIST(X, a) \
|
#define meshtastic_LocalConfig_FIELDLIST(X, a) \
|
||||||
@@ -161,7 +165,8 @@ X(a, STATIC, OPTIONAL, MESSAGE, remote_hardware, 10) \
|
|||||||
X(a, STATIC, OPTIONAL, MESSAGE, neighbor_info, 11) \
|
X(a, STATIC, OPTIONAL, MESSAGE, neighbor_info, 11) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, ambient_lighting, 12) \
|
X(a, STATIC, OPTIONAL, MESSAGE, ambient_lighting, 12) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, detection_sensor, 13) \
|
X(a, STATIC, OPTIONAL, MESSAGE, detection_sensor, 13) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, paxcounter, 14)
|
X(a, STATIC, OPTIONAL, MESSAGE, paxcounter, 14) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, statusmessage, 15)
|
||||||
#define meshtastic_LocalModuleConfig_CALLBACK NULL
|
#define meshtastic_LocalModuleConfig_CALLBACK NULL
|
||||||
#define meshtastic_LocalModuleConfig_DEFAULT NULL
|
#define meshtastic_LocalModuleConfig_DEFAULT NULL
|
||||||
#define meshtastic_LocalModuleConfig_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
#define meshtastic_LocalModuleConfig_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
||||||
@@ -177,6 +182,7 @@ X(a, STATIC, OPTIONAL, MESSAGE, paxcounter, 14)
|
|||||||
#define meshtastic_LocalModuleConfig_ambient_lighting_MSGTYPE meshtastic_ModuleConfig_AmbientLightingConfig
|
#define meshtastic_LocalModuleConfig_ambient_lighting_MSGTYPE meshtastic_ModuleConfig_AmbientLightingConfig
|
||||||
#define meshtastic_LocalModuleConfig_detection_sensor_MSGTYPE meshtastic_ModuleConfig_DetectionSensorConfig
|
#define meshtastic_LocalModuleConfig_detection_sensor_MSGTYPE meshtastic_ModuleConfig_DetectionSensorConfig
|
||||||
#define meshtastic_LocalModuleConfig_paxcounter_MSGTYPE meshtastic_ModuleConfig_PaxcounterConfig
|
#define meshtastic_LocalModuleConfig_paxcounter_MSGTYPE meshtastic_ModuleConfig_PaxcounterConfig
|
||||||
|
#define meshtastic_LocalModuleConfig_statusmessage_MSGTYPE meshtastic_ModuleConfig_StatusMessageConfig
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_LocalConfig_msg;
|
extern const pb_msgdesc_t meshtastic_LocalConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
||||||
@@ -186,9 +192,9 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
|||||||
#define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg
|
#define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size
|
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalModuleConfig_size
|
||||||
#define meshtastic_LocalConfig_size 749
|
#define meshtastic_LocalConfig_size 749
|
||||||
#define meshtastic_LocalModuleConfig_size 675
|
#define meshtastic_LocalModuleConfig_size 758
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ PB_BIND(meshtastic_StoreForwardPlusPlus, meshtastic_StoreForwardPlusPlus, 2)
|
|||||||
PB_BIND(meshtastic_Waypoint, meshtastic_Waypoint, AUTO)
|
PB_BIND(meshtastic_Waypoint, meshtastic_Waypoint, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_StatusMessage, meshtastic_StatusMessage, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_MqttClientProxyMessage, meshtastic_MqttClientProxyMessage, 2)
|
PB_BIND(meshtastic_MqttClientProxyMessage, meshtastic_MqttClientProxyMessage, 2)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -858,6 +858,11 @@ typedef struct _meshtastic_Waypoint {
|
|||||||
uint32_t icon;
|
uint32_t icon;
|
||||||
} meshtastic_Waypoint;
|
} meshtastic_Waypoint;
|
||||||
|
|
||||||
|
/* Message for node status */
|
||||||
|
typedef struct _meshtastic_StatusMessage {
|
||||||
|
char status[80];
|
||||||
|
} meshtastic_StatusMessage;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(435) meshtastic_MqttClientProxyMessage_data_t;
|
typedef PB_BYTES_ARRAY_T(435) meshtastic_MqttClientProxyMessage_data_t;
|
||||||
/* This message will be proxied over the PhoneAPI for the client to deliver to the MQTT server */
|
/* This message will be proxied over the PhoneAPI for the client to deliver to the MQTT server */
|
||||||
typedef struct _meshtastic_MqttClientProxyMessage {
|
typedef struct _meshtastic_MqttClientProxyMessage {
|
||||||
@@ -1402,6 +1407,7 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define meshtastic_MeshPacket_priority_ENUMTYPE meshtastic_MeshPacket_Priority
|
#define meshtastic_MeshPacket_priority_ENUMTYPE meshtastic_MeshPacket_Priority
|
||||||
#define meshtastic_MeshPacket_delayed_ENUMTYPE meshtastic_MeshPacket_Delayed
|
#define meshtastic_MeshPacket_delayed_ENUMTYPE meshtastic_MeshPacket_Delayed
|
||||||
#define meshtastic_MeshPacket_transport_mechanism_ENUMTYPE meshtastic_MeshPacket_TransportMechanism
|
#define meshtastic_MeshPacket_transport_mechanism_ENUMTYPE meshtastic_MeshPacket_TransportMechanism
|
||||||
@@ -1444,6 +1450,7 @@ extern "C" {
|
|||||||
#define meshtastic_KeyVerification_init_default {0, {0, {0}}, {0, {0}}}
|
#define meshtastic_KeyVerification_init_default {0, {0, {0}}, {0, {0}}}
|
||||||
#define meshtastic_StoreForwardPlusPlus_init_default {_meshtastic_StoreForwardPlusPlus_SFPP_message_type_MIN, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0, 0}
|
#define meshtastic_StoreForwardPlusPlus_init_default {_meshtastic_StoreForwardPlusPlus_SFPP_message_type_MIN, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Waypoint_init_default {0, false, 0, false, 0, 0, 0, "", "", 0}
|
#define meshtastic_Waypoint_init_default {0, false, 0, false, 0, 0, 0, "", "", 0}
|
||||||
|
#define meshtastic_StatusMessage_init_default {""}
|
||||||
#define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0}
|
#define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0}
|
||||||
#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0, _meshtastic_MeshPacket_TransportMechanism_MIN}
|
#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0, _meshtastic_MeshPacket_TransportMechanism_MIN}
|
||||||
#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0, 0, 0}
|
#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0, 0, 0}
|
||||||
@@ -1476,6 +1483,7 @@ extern "C" {
|
|||||||
#define meshtastic_KeyVerification_init_zero {0, {0, {0}}, {0, {0}}}
|
#define meshtastic_KeyVerification_init_zero {0, {0, {0}}, {0, {0}}}
|
||||||
#define meshtastic_StoreForwardPlusPlus_init_zero {_meshtastic_StoreForwardPlusPlus_SFPP_message_type_MIN, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0, 0}
|
#define meshtastic_StoreForwardPlusPlus_init_zero {_meshtastic_StoreForwardPlusPlus_SFPP_message_type_MIN, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Waypoint_init_zero {0, false, 0, false, 0, 0, 0, "", "", 0}
|
#define meshtastic_Waypoint_init_zero {0, false, 0, false, 0, 0, 0, "", "", 0}
|
||||||
|
#define meshtastic_StatusMessage_init_zero {""}
|
||||||
#define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0}
|
#define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0}
|
||||||
#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0, _meshtastic_MeshPacket_TransportMechanism_MIN}
|
#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0, _meshtastic_MeshPacket_TransportMechanism_MIN}
|
||||||
#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0, 0, 0}
|
#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0, 0, 0}
|
||||||
@@ -1571,6 +1579,7 @@ extern "C" {
|
|||||||
#define meshtastic_Waypoint_name_tag 6
|
#define meshtastic_Waypoint_name_tag 6
|
||||||
#define meshtastic_Waypoint_description_tag 7
|
#define meshtastic_Waypoint_description_tag 7
|
||||||
#define meshtastic_Waypoint_icon_tag 8
|
#define meshtastic_Waypoint_icon_tag 8
|
||||||
|
#define meshtastic_StatusMessage_status_tag 1
|
||||||
#define meshtastic_MqttClientProxyMessage_topic_tag 1
|
#define meshtastic_MqttClientProxyMessage_topic_tag 1
|
||||||
#define meshtastic_MqttClientProxyMessage_data_tag 2
|
#define meshtastic_MqttClientProxyMessage_data_tag 2
|
||||||
#define meshtastic_MqttClientProxyMessage_text_tag 3
|
#define meshtastic_MqttClientProxyMessage_text_tag 3
|
||||||
@@ -1806,6 +1815,11 @@ X(a, STATIC, SINGULAR, FIXED32, icon, 8)
|
|||||||
#define meshtastic_Waypoint_CALLBACK NULL
|
#define meshtastic_Waypoint_CALLBACK NULL
|
||||||
#define meshtastic_Waypoint_DEFAULT NULL
|
#define meshtastic_Waypoint_DEFAULT NULL
|
||||||
|
|
||||||
|
#define meshtastic_StatusMessage_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, status, 1)
|
||||||
|
#define meshtastic_StatusMessage_CALLBACK NULL
|
||||||
|
#define meshtastic_StatusMessage_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_MqttClientProxyMessage_FIELDLIST(X, a) \
|
#define meshtastic_MqttClientProxyMessage_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, STRING, topic, 1) \
|
X(a, STATIC, SINGULAR, STRING, topic, 1) \
|
||||||
X(a, STATIC, ONEOF, BYTES, (payload_variant,data,payload_variant.data), 2) \
|
X(a, STATIC, ONEOF, BYTES, (payload_variant,data,payload_variant.data), 2) \
|
||||||
@@ -2072,6 +2086,7 @@ extern const pb_msgdesc_t meshtastic_Data_msg;
|
|||||||
extern const pb_msgdesc_t meshtastic_KeyVerification_msg;
|
extern const pb_msgdesc_t meshtastic_KeyVerification_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_StoreForwardPlusPlus_msg;
|
extern const pb_msgdesc_t meshtastic_StoreForwardPlusPlus_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_Waypoint_msg;
|
extern const pb_msgdesc_t meshtastic_Waypoint_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_StatusMessage_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_MqttClientProxyMessage_msg;
|
extern const pb_msgdesc_t meshtastic_MqttClientProxyMessage_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_MeshPacket_msg;
|
extern const pb_msgdesc_t meshtastic_MeshPacket_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_NodeInfo_msg;
|
extern const pb_msgdesc_t meshtastic_NodeInfo_msg;
|
||||||
@@ -2106,6 +2121,7 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
|
|||||||
#define meshtastic_KeyVerification_fields &meshtastic_KeyVerification_msg
|
#define meshtastic_KeyVerification_fields &meshtastic_KeyVerification_msg
|
||||||
#define meshtastic_StoreForwardPlusPlus_fields &meshtastic_StoreForwardPlusPlus_msg
|
#define meshtastic_StoreForwardPlusPlus_fields &meshtastic_StoreForwardPlusPlus_msg
|
||||||
#define meshtastic_Waypoint_fields &meshtastic_Waypoint_msg
|
#define meshtastic_Waypoint_fields &meshtastic_Waypoint_msg
|
||||||
|
#define meshtastic_StatusMessage_fields &meshtastic_StatusMessage_msg
|
||||||
#define meshtastic_MqttClientProxyMessage_fields &meshtastic_MqttClientProxyMessage_msg
|
#define meshtastic_MqttClientProxyMessage_fields &meshtastic_MqttClientProxyMessage_msg
|
||||||
#define meshtastic_MeshPacket_fields &meshtastic_MeshPacket_msg
|
#define meshtastic_MeshPacket_fields &meshtastic_MeshPacket_msg
|
||||||
#define meshtastic_NodeInfo_fields &meshtastic_NodeInfo_msg
|
#define meshtastic_NodeInfo_fields &meshtastic_NodeInfo_msg
|
||||||
@@ -2161,6 +2177,7 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
|
|||||||
#define meshtastic_QueueStatus_size 23
|
#define meshtastic_QueueStatus_size 23
|
||||||
#define meshtastic_RouteDiscovery_size 256
|
#define meshtastic_RouteDiscovery_size 256
|
||||||
#define meshtastic_Routing_size 259
|
#define meshtastic_Routing_size 259
|
||||||
|
#define meshtastic_StatusMessage_size 81
|
||||||
#define meshtastic_StoreForwardPlusPlus_size 377
|
#define meshtastic_StoreForwardPlusPlus_size 377
|
||||||
#define meshtastic_ToRadio_size 504
|
#define meshtastic_ToRadio_size 504
|
||||||
#define meshtastic_User_size 115
|
#define meshtastic_User_size 115
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ PB_BIND(meshtastic_ModuleConfig_CannedMessageConfig, meshtastic_ModuleConfig_Can
|
|||||||
PB_BIND(meshtastic_ModuleConfig_AmbientLightingConfig, meshtastic_ModuleConfig_AmbientLightingConfig, AUTO)
|
PB_BIND(meshtastic_ModuleConfig_AmbientLightingConfig, meshtastic_ModuleConfig_AmbientLightingConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_ModuleConfig_StatusMessageConfig, meshtastic_ModuleConfig_StatusMessageConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_RemoteHardwarePin, meshtastic_RemoteHardwarePin, AUTO)
|
PB_BIND(meshtastic_RemoteHardwarePin, meshtastic_RemoteHardwarePin, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -409,6 +409,12 @@ typedef struct _meshtastic_ModuleConfig_AmbientLightingConfig {
|
|||||||
uint8_t blue;
|
uint8_t blue;
|
||||||
} meshtastic_ModuleConfig_AmbientLightingConfig;
|
} meshtastic_ModuleConfig_AmbientLightingConfig;
|
||||||
|
|
||||||
|
/* StatusMessage config - Allows setting a status message for a node to periodically rebroadcast */
|
||||||
|
typedef struct _meshtastic_ModuleConfig_StatusMessageConfig {
|
||||||
|
/* The actual status string */
|
||||||
|
char node_status[80];
|
||||||
|
} meshtastic_ModuleConfig_StatusMessageConfig;
|
||||||
|
|
||||||
/* A GPIO pin definition for remote hardware module */
|
/* A GPIO pin definition for remote hardware module */
|
||||||
typedef struct _meshtastic_RemoteHardwarePin {
|
typedef struct _meshtastic_RemoteHardwarePin {
|
||||||
/* GPIO Pin number (must match Arduino) */
|
/* GPIO Pin number (must match Arduino) */
|
||||||
@@ -460,6 +466,8 @@ typedef struct _meshtastic_ModuleConfig {
|
|||||||
meshtastic_ModuleConfig_DetectionSensorConfig detection_sensor;
|
meshtastic_ModuleConfig_DetectionSensorConfig detection_sensor;
|
||||||
/* TODO: REPLACE */
|
/* TODO: REPLACE */
|
||||||
meshtastic_ModuleConfig_PaxcounterConfig paxcounter;
|
meshtastic_ModuleConfig_PaxcounterConfig paxcounter;
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
meshtastic_ModuleConfig_StatusMessageConfig statusmessage;
|
||||||
} payload_variant;
|
} payload_variant;
|
||||||
} meshtastic_ModuleConfig;
|
} meshtastic_ModuleConfig;
|
||||||
|
|
||||||
@@ -515,6 +523,7 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_press_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_press_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define meshtastic_RemoteHardwarePin_type_ENUMTYPE meshtastic_RemoteHardwarePinType
|
#define meshtastic_RemoteHardwarePin_type_ENUMTYPE meshtastic_RemoteHardwarePinType
|
||||||
|
|
||||||
|
|
||||||
@@ -534,6 +543,7 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
#define meshtastic_ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_init_default {0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_init_default {0, 0, 0, 0, 0}
|
||||||
|
#define meshtastic_ModuleConfig_StatusMessageConfig_init_default {""}
|
||||||
#define meshtastic_RemoteHardwarePin_init_default {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
#define meshtastic_RemoteHardwarePin_init_default {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
||||||
#define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}}
|
#define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}}
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_zero}
|
#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0, "", 0, 0, false, meshtastic_ModuleConfig_MapReportSettings_init_zero}
|
||||||
@@ -550,6 +560,7 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
#define meshtastic_ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_init_zero {0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_init_zero {0, 0, 0, 0, 0}
|
||||||
|
#define meshtastic_ModuleConfig_StatusMessageConfig_init_zero {""}
|
||||||
#define meshtastic_RemoteHardwarePin_init_zero {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
#define meshtastic_RemoteHardwarePin_init_zero {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
@@ -653,6 +664,7 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_red_tag 3
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_red_tag 3
|
||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_green_tag 4
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_green_tag 4
|
||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_blue_tag 5
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_blue_tag 5
|
||||||
|
#define meshtastic_ModuleConfig_StatusMessageConfig_node_status_tag 1
|
||||||
#define meshtastic_RemoteHardwarePin_gpio_pin_tag 1
|
#define meshtastic_RemoteHardwarePin_gpio_pin_tag 1
|
||||||
#define meshtastic_RemoteHardwarePin_name_tag 2
|
#define meshtastic_RemoteHardwarePin_name_tag 2
|
||||||
#define meshtastic_RemoteHardwarePin_type_tag 3
|
#define meshtastic_RemoteHardwarePin_type_tag 3
|
||||||
@@ -672,6 +684,7 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_ambient_lighting_tag 11
|
#define meshtastic_ModuleConfig_ambient_lighting_tag 11
|
||||||
#define meshtastic_ModuleConfig_detection_sensor_tag 12
|
#define meshtastic_ModuleConfig_detection_sensor_tag 12
|
||||||
#define meshtastic_ModuleConfig_paxcounter_tag 13
|
#define meshtastic_ModuleConfig_paxcounter_tag 13
|
||||||
|
#define meshtastic_ModuleConfig_statusmessage_tag 14
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define meshtastic_ModuleConfig_FIELDLIST(X, a) \
|
#define meshtastic_ModuleConfig_FIELDLIST(X, a) \
|
||||||
@@ -687,7 +700,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,remote_hardware,payload_vari
|
|||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,neighbor_info,payload_variant.neighbor_info), 10) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,neighbor_info,payload_variant.neighbor_info), 10) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,ambient_lighting,payload_variant.ambient_lighting), 11) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,ambient_lighting,payload_variant.ambient_lighting), 11) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,detection_sensor,payload_variant.detection_sensor), 12) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,detection_sensor,payload_variant.detection_sensor), 12) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,paxcounter,payload_variant.paxcounter), 13)
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,paxcounter,payload_variant.paxcounter), 13) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,statusmessage,payload_variant.statusmessage), 14)
|
||||||
#define meshtastic_ModuleConfig_CALLBACK NULL
|
#define meshtastic_ModuleConfig_CALLBACK NULL
|
||||||
#define meshtastic_ModuleConfig_DEFAULT NULL
|
#define meshtastic_ModuleConfig_DEFAULT NULL
|
||||||
#define meshtastic_ModuleConfig_payload_variant_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
#define meshtastic_ModuleConfig_payload_variant_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
||||||
@@ -703,6 +717,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,paxcounter,payload_variant.p
|
|||||||
#define meshtastic_ModuleConfig_payload_variant_ambient_lighting_MSGTYPE meshtastic_ModuleConfig_AmbientLightingConfig
|
#define meshtastic_ModuleConfig_payload_variant_ambient_lighting_MSGTYPE meshtastic_ModuleConfig_AmbientLightingConfig
|
||||||
#define meshtastic_ModuleConfig_payload_variant_detection_sensor_MSGTYPE meshtastic_ModuleConfig_DetectionSensorConfig
|
#define meshtastic_ModuleConfig_payload_variant_detection_sensor_MSGTYPE meshtastic_ModuleConfig_DetectionSensorConfig
|
||||||
#define meshtastic_ModuleConfig_payload_variant_paxcounter_MSGTYPE meshtastic_ModuleConfig_PaxcounterConfig
|
#define meshtastic_ModuleConfig_payload_variant_paxcounter_MSGTYPE meshtastic_ModuleConfig_PaxcounterConfig
|
||||||
|
#define meshtastic_ModuleConfig_payload_variant_statusmessage_MSGTYPE meshtastic_ModuleConfig_StatusMessageConfig
|
||||||
|
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
|
#define meshtastic_ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||||
@@ -865,6 +880,11 @@ X(a, STATIC, SINGULAR, UINT32, blue, 5)
|
|||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_CALLBACK NULL
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_CALLBACK NULL
|
||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_DEFAULT NULL
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define meshtastic_ModuleConfig_StatusMessageConfig_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, node_status, 1)
|
||||||
|
#define meshtastic_ModuleConfig_StatusMessageConfig_CALLBACK NULL
|
||||||
|
#define meshtastic_ModuleConfig_StatusMessageConfig_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_RemoteHardwarePin_FIELDLIST(X, a) \
|
#define meshtastic_RemoteHardwarePin_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, gpio_pin, 1) \
|
X(a, STATIC, SINGULAR, UINT32, gpio_pin, 1) \
|
||||||
X(a, STATIC, SINGULAR, STRING, name, 2) \
|
X(a, STATIC, SINGULAR, STRING, name, 2) \
|
||||||
@@ -887,6 +907,7 @@ extern const pb_msgdesc_t meshtastic_ModuleConfig_RangeTestConfig_msg;
|
|||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_TelemetryConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_TelemetryConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_CannedMessageConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_CannedMessageConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_AmbientLightingConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_AmbientLightingConfig_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_StatusMessageConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
|
extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
@@ -905,6 +926,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
|
|||||||
#define meshtastic_ModuleConfig_TelemetryConfig_fields &meshtastic_ModuleConfig_TelemetryConfig_msg
|
#define meshtastic_ModuleConfig_TelemetryConfig_fields &meshtastic_ModuleConfig_TelemetryConfig_msg
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_fields &meshtastic_ModuleConfig_CannedMessageConfig_msg
|
#define meshtastic_ModuleConfig_CannedMessageConfig_fields &meshtastic_ModuleConfig_CannedMessageConfig_msg
|
||||||
#define meshtastic_ModuleConfig_AmbientLightingConfig_fields &meshtastic_ModuleConfig_AmbientLightingConfig_msg
|
#define meshtastic_ModuleConfig_AmbientLightingConfig_fields &meshtastic_ModuleConfig_AmbientLightingConfig_msg
|
||||||
|
#define meshtastic_ModuleConfig_StatusMessageConfig_fields &meshtastic_ModuleConfig_StatusMessageConfig_msg
|
||||||
#define meshtastic_RemoteHardwarePin_fields &meshtastic_RemoteHardwarePin_msg
|
#define meshtastic_RemoteHardwarePin_fields &meshtastic_RemoteHardwarePin_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
@@ -921,6 +943,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
|
|||||||
#define meshtastic_ModuleConfig_RangeTestConfig_size 12
|
#define meshtastic_ModuleConfig_RangeTestConfig_size 12
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_size 96
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_size 96
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_size 28
|
#define meshtastic_ModuleConfig_SerialConfig_size 28
|
||||||
|
#define meshtastic_ModuleConfig_StatusMessageConfig_size 81
|
||||||
#define meshtastic_ModuleConfig_StoreForwardConfig_size 24
|
#define meshtastic_ModuleConfig_StoreForwardConfig_size 24
|
||||||
#define meshtastic_ModuleConfig_TelemetryConfig_size 50
|
#define meshtastic_ModuleConfig_TelemetryConfig_size 50
|
||||||
#define meshtastic_ModuleConfig_size 227
|
#define meshtastic_ModuleConfig_size 227
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ typedef enum _meshtastic_PortNum {
|
|||||||
This module is specifically for Native Linux nodes, and provides a Git-style
|
This module is specifically for Native Linux nodes, and provides a Git-style
|
||||||
chain of messages. */
|
chain of messages. */
|
||||||
meshtastic_PortNum_STORE_FORWARD_PLUSPLUS_APP = 35,
|
meshtastic_PortNum_STORE_FORWARD_PLUSPLUS_APP = 35,
|
||||||
|
/* Node Status module
|
||||||
|
ENCODING: protobuf
|
||||||
|
This module allows setting an extra string of status for a node.
|
||||||
|
Broadcasts on change and on a timer, possibly once a day. */
|
||||||
|
meshtastic_PortNum_NODE_STATUS_APP = 36,
|
||||||
/* Provides a hardware serial interface to send and receive from the Meshtastic network.
|
/* Provides a hardware serial interface to send and receive from the Meshtastic network.
|
||||||
Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic
|
Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic
|
||||||
network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network.
|
network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network.
|
||||||
|
|||||||
@@ -361,6 +361,8 @@ typedef struct _meshtastic_LocalStats {
|
|||||||
uint32_t heap_free_bytes;
|
uint32_t heap_free_bytes;
|
||||||
/* Number of packets that were dropped because the transmit queue was full. */
|
/* Number of packets that were dropped because the transmit queue was full. */
|
||||||
uint16_t num_tx_dropped;
|
uint16_t num_tx_dropped;
|
||||||
|
/* Noise floor value measured in dBm */
|
||||||
|
int32_t noise_floor;
|
||||||
} meshtastic_LocalStats;
|
} meshtastic_LocalStats;
|
||||||
|
|
||||||
/* Health telemetry metrics */
|
/* Health telemetry metrics */
|
||||||
@@ -458,7 +460,7 @@ extern "C" {
|
|||||||
#define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_PowerMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_PowerMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_AirQualityMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_AirQualityMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_LocalStats_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_LocalStats_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_HealthMetrics_init_default {false, 0, false, 0, false, 0}
|
#define meshtastic_HealthMetrics_init_default {false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_HostMetrics_init_default {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""}
|
#define meshtastic_HostMetrics_init_default {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""}
|
||||||
#define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}}
|
#define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}}
|
||||||
@@ -467,7 +469,7 @@ extern "C" {
|
|||||||
#define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_PowerMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_PowerMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_AirQualityMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_AirQualityMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_LocalStats_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_LocalStats_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_HealthMetrics_init_zero {false, 0, false, 0, false, 0}
|
#define meshtastic_HealthMetrics_init_zero {false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_HostMetrics_init_zero {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""}
|
#define meshtastic_HostMetrics_init_zero {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""}
|
||||||
#define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}}
|
#define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}}
|
||||||
@@ -556,6 +558,7 @@ extern "C" {
|
|||||||
#define meshtastic_LocalStats_heap_total_bytes_tag 12
|
#define meshtastic_LocalStats_heap_total_bytes_tag 12
|
||||||
#define meshtastic_LocalStats_heap_free_bytes_tag 13
|
#define meshtastic_LocalStats_heap_free_bytes_tag 13
|
||||||
#define meshtastic_LocalStats_num_tx_dropped_tag 14
|
#define meshtastic_LocalStats_num_tx_dropped_tag 14
|
||||||
|
#define meshtastic_LocalStats_noise_floor_tag 15
|
||||||
#define meshtastic_HealthMetrics_heart_bpm_tag 1
|
#define meshtastic_HealthMetrics_heart_bpm_tag 1
|
||||||
#define meshtastic_HealthMetrics_spO2_tag 2
|
#define meshtastic_HealthMetrics_spO2_tag 2
|
||||||
#define meshtastic_HealthMetrics_temperature_tag 3
|
#define meshtastic_HealthMetrics_temperature_tag 3
|
||||||
@@ -678,7 +681,8 @@ X(a, STATIC, SINGULAR, UINT32, num_tx_relay, 10) \
|
|||||||
X(a, STATIC, SINGULAR, UINT32, num_tx_relay_canceled, 11) \
|
X(a, STATIC, SINGULAR, UINT32, num_tx_relay_canceled, 11) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, heap_total_bytes, 12) \
|
X(a, STATIC, SINGULAR, UINT32, heap_total_bytes, 12) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, heap_free_bytes, 13) \
|
X(a, STATIC, SINGULAR, UINT32, heap_free_bytes, 13) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, num_tx_dropped, 14)
|
X(a, STATIC, SINGULAR, UINT32, num_tx_dropped, 14) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, noise_floor, 15)
|
||||||
#define meshtastic_LocalStats_CALLBACK NULL
|
#define meshtastic_LocalStats_CALLBACK NULL
|
||||||
#define meshtastic_LocalStats_DEFAULT NULL
|
#define meshtastic_LocalStats_DEFAULT NULL
|
||||||
|
|
||||||
@@ -755,7 +759,7 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg;
|
|||||||
#define meshtastic_EnvironmentMetrics_size 113
|
#define meshtastic_EnvironmentMetrics_size 113
|
||||||
#define meshtastic_HealthMetrics_size 11
|
#define meshtastic_HealthMetrics_size 11
|
||||||
#define meshtastic_HostMetrics_size 264
|
#define meshtastic_HostMetrics_size 264
|
||||||
#define meshtastic_LocalStats_size 76
|
#define meshtastic_LocalStats_size 87
|
||||||
#define meshtastic_Nau7802Config_size 16
|
#define meshtastic_Nau7802Config_size 16
|
||||||
#define meshtastic_PowerMetrics_size 81
|
#define meshtastic_PowerMetrics_size 81
|
||||||
#define meshtastic_Telemetry_size 272
|
#define meshtastic_Telemetry_size 272
|
||||||
|
|||||||
@@ -235,22 +235,46 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
}
|
}
|
||||||
case meshtastic_AdminMessage_ota_request_tag: {
|
case meshtastic_AdminMessage_ota_request_tag: {
|
||||||
#if defined(ARCH_ESP32)
|
#if defined(ARCH_ESP32)
|
||||||
|
LOG_INFO("OTA Requested");
|
||||||
|
|
||||||
if (r->ota_request.ota_hash.size != 32) {
|
if (r->ota_request.ota_hash.size != 32) {
|
||||||
suppressRebootBanner = true;
|
suppressRebootBanner = true;
|
||||||
LOG_INFO("OTA Failed: Invalid `ota_hash` provided");
|
sendWarningAndLog("Cannot start OTA: Invalid `ota_hash` provided.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
meshtastic_OTAMode mode = r->ota_request.reboot_ota_mode;
|
meshtastic_OTAMode mode = r->ota_request.reboot_ota_mode;
|
||||||
|
const char *mode_name = (mode == METHOD_OTA_BLE ? "BLE" : "WiFi");
|
||||||
|
|
||||||
|
// Check that we have an OTA partition
|
||||||
|
const esp_partition_t *part = MeshtasticOTA::getAppPartition();
|
||||||
|
if (part == NULL) {
|
||||||
|
suppressRebootBanner = true;
|
||||||
|
sendWarningAndLog("Cannot start OTA: Cannot find OTA Loader partition.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
static esp_app_desc_t app_desc;
|
||||||
|
if (!MeshtasticOTA::getAppDesc(part, &app_desc)) {
|
||||||
|
suppressRebootBanner = true;
|
||||||
|
sendWarningAndLog("Cannot start OTA: Device does have a valid OTA Loader.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!MeshtasticOTA::checkOTACapability(&app_desc, mode)) {
|
||||||
|
suppressRebootBanner = true;
|
||||||
|
sendWarningAndLog("OTA Loader does not support %s", mode_name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (MeshtasticOTA::trySwitchToOTA()) {
|
if (MeshtasticOTA::trySwitchToOTA()) {
|
||||||
LOG_INFO("OTA Requested");
|
|
||||||
suppressRebootBanner = true;
|
suppressRebootBanner = true;
|
||||||
if (screen)
|
if (screen)
|
||||||
screen->startFirmwareUpdateScreen();
|
screen->startFirmwareUpdateScreen();
|
||||||
MeshtasticOTA::saveConfig(&config.network, mode, r->ota_request.ota_hash.bytes);
|
MeshtasticOTA::saveConfig(&config.network, mode, r->ota_request.ota_hash.bytes);
|
||||||
LOG_INFO("Rebooting to WiFi OTA");
|
sendWarningAndLog("Rebooting to %s OTA", mode_name);
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("WIFI OTA Failed");
|
sendWarningAndLog("Unable to switch to the OTA partition.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
int s = 1; // Reboot in 1 second, hard coded
|
int s = 1; // Reboot in 1 second, hard coded
|
||||||
@@ -1472,15 +1496,43 @@ void AdminModule::handleSendInputEvent(const meshtastic_AdminMessage_InputEvent
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminModule::sendWarning(const char *message)
|
void AdminModule::sendWarning(const char *format, ...)
|
||||||
{
|
{
|
||||||
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
|
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
|
||||||
|
if (!cn)
|
||||||
|
return;
|
||||||
|
|
||||||
cn->level = meshtastic_LogRecord_Level_WARNING;
|
cn->level = meshtastic_LogRecord_Level_WARNING;
|
||||||
cn->time = getValidTime(RTCQualityFromNet);
|
cn->time = getValidTime(RTCQualityFromNet);
|
||||||
strncpy(cn->message, message, sizeof(cn->message));
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
// Format the arguments directly into the notification object
|
||||||
|
vsnprintf(cn->message, sizeof(cn->message), format, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
service->sendClientNotification(cn);
|
service->sendClientNotification(cn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdminModule::sendWarningAndLog(const char *format, ...)
|
||||||
|
{
|
||||||
|
// We need a temporary buffer to hold the formatted text so we can log it
|
||||||
|
// Using 250 bytes as a safe upper limit for typical text notifications
|
||||||
|
char buf[250];
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
vsnprintf(buf, sizeof(buf), format, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
LOG_WARN(buf);
|
||||||
|
// 2. Call sendWarning
|
||||||
|
// SECURITY NOTE: We pass "%s", buf instead of just 'buf'.
|
||||||
|
// If 'buf' contained a % symbol (e.g. "Battery 50%"), passing it directly
|
||||||
|
// would crash sendWarning. "%s" treats it purely as text.
|
||||||
|
sendWarning("%s", buf);
|
||||||
|
}
|
||||||
|
|
||||||
void disableBluetooth()
|
void disableBluetooth()
|
||||||
{
|
{
|
||||||
#if HAS_BLUETOOTH
|
#if HAS_BLUETOOTH
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#ifdef ESP_PLATFORM
|
||||||
|
#include <esp_ota_ops.h>
|
||||||
|
#endif
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
|
#include <sys/types.h>
|
||||||
#if HAS_WIFI
|
#if HAS_WIFI
|
||||||
#include "mesh/wifi/WiFiAPClient.h"
|
#include "mesh/wifi/WiFiAPClient.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -71,7 +73,8 @@ class AdminModule : public ProtobufModule<meshtastic_AdminMessage>, public Obser
|
|||||||
|
|
||||||
bool messageIsResponse(const meshtastic_AdminMessage *r);
|
bool messageIsResponse(const meshtastic_AdminMessage *r);
|
||||||
bool messageIsRequest(const meshtastic_AdminMessage *r);
|
bool messageIsRequest(const meshtastic_AdminMessage *r);
|
||||||
void sendWarning(const char *message);
|
void sendWarning(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||||
|
void sendWarningAndLog(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr const char *licensedModeMessage =
|
static constexpr const char *licensedModeMessage =
|
||||||
|
|||||||
@@ -50,9 +50,10 @@ int StatusLEDModule::handleStatusUpdate(const meshtastic::Status *arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case meshtastic::BluetoothStatus::ConnectionState::CONNECTED: {
|
case meshtastic::BluetoothStatus::ConnectionState::CONNECTED: {
|
||||||
ble_state = connected;
|
if (ble_state != connected) {
|
||||||
PAIRING_LED_starttime = millis();
|
ble_state = connected;
|
||||||
break;
|
PAIRING_LED_starttime = millis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
#include "MeshtasticOTA.h"
|
#include "MeshtasticOTA.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#ifdef ESP_PLATFORM
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
#include <esp_ota_ops.h>
|
#include <esp_ota_ops.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace MeshtasticOTA
|
namespace MeshtasticOTA
|
||||||
{
|
{
|
||||||
|
|
||||||
static const char *nvsNamespace = "MeshtasticOTA";
|
static const char *nvsNamespace = "MeshtasticOTA";
|
||||||
static const char *appProjectName = "MeshtasticOTA";
|
static const char *combinedAppProjectName = "MeshtasticOTA";
|
||||||
|
static const char *bleOnlyAppProjectName = "MeshtasticOTA-BLE";
|
||||||
|
static const char *wifiOnlyAppProjectName = "MeshtasticOTA-WiFi";
|
||||||
|
|
||||||
static bool updated = false;
|
static bool updated = false;
|
||||||
|
|
||||||
@@ -68,21 +72,44 @@ bool getAppDesc(const esp_partition_t *part, esp_app_desc_t *app_desc)
|
|||||||
LOG_INFO("esp_ota_get_partition_description failed");
|
LOG_INFO("esp_ota_get_partition_description failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (strcmp(app_desc->project_name, appProjectName) != 0) {
|
|
||||||
LOG_INFO("app_desc->project_name == 0");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool checkOTACapability(esp_app_desc_t *app_desc, uint8_t method)
|
||||||
|
{
|
||||||
|
// Combined loader supports all (both) transports, BLE and WiFi
|
||||||
|
if (strcmp(app_desc->project_name, combinedAppProjectName) == 0) {
|
||||||
|
LOG_INFO("OTA partition contains combined BLE/WiFi OTA Loader");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (method == METHOD_OTA_BLE && strcmp(app_desc->project_name, bleOnlyAppProjectName) == 0) {
|
||||||
|
LOG_INFO("OTA partition contains BLE-only OTA Loader");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (method == METHOD_OTA_WIFI && strcmp(app_desc->project_name, wifiOnlyAppProjectName) == 0) {
|
||||||
|
LOG_INFO("OTA partition contains WiFi-only OTA Loader");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
LOG_INFO("OTA partition does not contain a known OTA loader");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool trySwitchToOTA()
|
bool trySwitchToOTA()
|
||||||
{
|
{
|
||||||
const esp_partition_t *part = getAppPartition();
|
const esp_partition_t *part = getAppPartition();
|
||||||
esp_app_desc_t app_desc;
|
|
||||||
if (!getAppDesc(part, &app_desc))
|
if (part == NULL) {
|
||||||
|
LOG_WARN("Unable to get app partition in preparation of OTA reboot");
|
||||||
return false;
|
return false;
|
||||||
if (esp_ota_set_boot_partition(part) != ESP_OK)
|
}
|
||||||
|
|
||||||
|
uint8_t result = esp_ota_set_boot_partition(part);
|
||||||
|
// Partition and app checks should now be done in the AdminModule before this is called
|
||||||
|
if (result != ESP_OK) {
|
||||||
|
LOG_WARN("Unable to switch to OTA partiton. (Reason %d)", result);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,20 @@
|
|||||||
|
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#ifdef ESP_PLATFORM
|
||||||
|
#include <esp_ota_ops.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define METHOD_OTA_BLE 1
|
||||||
|
#define METHOD_OTA_WIFI 2
|
||||||
|
|
||||||
namespace MeshtasticOTA
|
namespace MeshtasticOTA
|
||||||
{
|
{
|
||||||
void initialize();
|
void initialize();
|
||||||
bool isUpdated();
|
bool isUpdated();
|
||||||
|
const esp_partition_t *getAppPartition();
|
||||||
|
bool getAppDesc(const esp_partition_t *part, esp_app_desc_t *app_desc);
|
||||||
|
bool checkOTACapability(esp_app_desc_t *app_desc, uint8_t method);
|
||||||
void recoverConfig(meshtastic_Config_NetworkConfig *network);
|
void recoverConfig(meshtastic_Config_NetworkConfig *network);
|
||||||
void saveConfig(meshtastic_Config_NetworkConfig *network, meshtastic_OTAMode method, uint8_t *ota_hash);
|
void saveConfig(meshtastic_Config_NetworkConfig *network, meshtastic_OTAMode method, uint8_t *ota_hash);
|
||||||
bool trySwitchToOTA();
|
bool trySwitchToOTA();
|
||||||
|
|||||||
@@ -649,6 +649,19 @@ bool loadConfig(const char *configPath)
|
|||||||
if (yamlConfig["Lora"]["RF95_MAX_POWER"])
|
if (yamlConfig["Lora"]["RF95_MAX_POWER"])
|
||||||
portduino_config.rf95_max_power = yamlConfig["Lora"]["RF95_MAX_POWER"].as<int>(20);
|
portduino_config.rf95_max_power = yamlConfig["Lora"]["RF95_MAX_POWER"].as<int>(20);
|
||||||
|
|
||||||
|
if (yamlConfig["Lora"]["TX_GAIN_LORA"]) {
|
||||||
|
YAML::Node tx_gain_node = yamlConfig["Lora"]["TX_GAIN_LORA"];
|
||||||
|
if (tx_gain_node.IsSequence() && tx_gain_node.size() != 0) {
|
||||||
|
portduino_config.num_pa_points = min(tx_gain_node.size(), std::size(portduino_config.tx_gain_lora));
|
||||||
|
for (int i = 0; i < portduino_config.num_pa_points; i++) {
|
||||||
|
portduino_config.tx_gain_lora[i] = tx_gain_node[i].as<int>();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
portduino_config.num_pa_points = 1;
|
||||||
|
portduino_config.tx_gain_lora[0] = tx_gain_node.as<int>(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (portduino_config.lora_module != use_autoconf && portduino_config.lora_module != use_simradio &&
|
if (portduino_config.lora_module != use_autoconf && portduino_config.lora_module != use_simradio &&
|
||||||
!portduino_config.force_simradio) {
|
!portduino_config.force_simradio) {
|
||||||
portduino_config.dio2_as_rf_switch = yamlConfig["Lora"]["DIO2_AS_RF_SWITCH"].as<bool>(false);
|
portduino_config.dio2_as_rf_switch = yamlConfig["Lora"]["DIO2_AS_RF_SWITCH"].as<bool>(false);
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ extern struct portduino_config_struct {
|
|||||||
int lora_usb_pid = 0x5512;
|
int lora_usb_pid = 0x5512;
|
||||||
int lora_usb_vid = 0x1A86;
|
int lora_usb_vid = 0x1A86;
|
||||||
int spiSpeed = 2000000;
|
int spiSpeed = 2000000;
|
||||||
|
int num_pa_points = 1; // default to 1 point, with 0 gain
|
||||||
|
uint16_t tx_gain_lora[22] = {0};
|
||||||
pinMapping lora_cs_pin = {"Lora", "CS"};
|
pinMapping lora_cs_pin = {"Lora", "CS"};
|
||||||
pinMapping lora_irq_pin = {"Lora", "IRQ"};
|
pinMapping lora_irq_pin = {"Lora", "IRQ"};
|
||||||
pinMapping lora_busy_pin = {"Lora", "Busy"};
|
pinMapping lora_busy_pin = {"Lora", "Busy"};
|
||||||
@@ -231,6 +233,17 @@ extern struct portduino_config_struct {
|
|||||||
out << YAML::Key << "LR1120_MAX_POWER" << YAML::Value << lr1120_max_power;
|
out << YAML::Key << "LR1120_MAX_POWER" << YAML::Value << lr1120_max_power;
|
||||||
if (rf95_max_power != 20)
|
if (rf95_max_power != 20)
|
||||||
out << YAML::Key << "RF95_MAX_POWER" << YAML::Value << rf95_max_power;
|
out << YAML::Key << "RF95_MAX_POWER" << YAML::Value << rf95_max_power;
|
||||||
|
|
||||||
|
if (num_pa_points > 1) {
|
||||||
|
out << YAML::Key << "TX_GAIN_LORA" << YAML::Value << YAML::Flow << YAML::BeginSeq;
|
||||||
|
for (int i = 0; i < num_pa_points; i++) {
|
||||||
|
out << YAML::Value << tx_gain_lora[i];
|
||||||
|
}
|
||||||
|
out << YAML::EndSeq;
|
||||||
|
} else if (tx_gain_lora[0] != 0) {
|
||||||
|
out << YAML::Key << "TX_GAIN_LORA" << YAML::Value << tx_gain_lora[0];
|
||||||
|
}
|
||||||
|
|
||||||
out << YAML::Key << "DIO2_AS_RF_SWITCH" << YAML::Value << dio2_as_rf_switch;
|
out << YAML::Key << "DIO2_AS_RF_SWITCH" << YAML::Value << dio2_as_rf_switch;
|
||||||
if (dio3_tcxo_voltage != 0)
|
if (dio3_tcxo_voltage != 0)
|
||||||
out << YAML::Key << "DIO3_TCXO_VOLTAGE" << YAML::Value << YAML::Precision(3) << (float)dio3_tcxo_voltage / 1000;
|
out << YAML::Key << "DIO3_TCXO_VOLTAGE" << YAML::Value << YAML::Precision(3) << (float)dio3_tcxo_voltage / 1000;
|
||||||
|
|||||||
@@ -7,3 +7,22 @@ custom_esp32_kind = esp32
|
|||||||
build_flags =
|
build_flags =
|
||||||
${esp32_common.build_flags}
|
${esp32_common.build_flags}
|
||||||
-DMESHTASTIC_EXCLUDE_AUDIO=1
|
-DMESHTASTIC_EXCLUDE_AUDIO=1
|
||||||
|
; Override lib_deps to use environmental_extra_no_bsec instead of environmental_extra
|
||||||
|
; BSEC library uses ~3.5KB DRAM which causes overflow on original ESP32 targets
|
||||||
|
lib_deps =
|
||||||
|
${arduino_base.lib_deps}
|
||||||
|
${networking_base.lib_deps}
|
||||||
|
${networking_extra.lib_deps}
|
||||||
|
${environmental_base.lib_deps}
|
||||||
|
${environmental_extra_no_bsec.lib_deps}
|
||||||
|
${radiolib_base.lib_deps}
|
||||||
|
# renovate: datasource=git-refs depName=meshtastic-esp32_https_server packageName=https://github.com/meshtastic/esp32_https_server gitBranch=master
|
||||||
|
https://github.com/meshtastic/esp32_https_server/archive/3223704846752e6d545139204837bdb2a55459ca.zip
|
||||||
|
# renovate: datasource=custom.pio depName=NimBLE-Arduino packageName=h2zero/library/NimBLE-Arduino
|
||||||
|
h2zero/NimBLE-Arduino@^1.4.3
|
||||||
|
# renovate: datasource=git-refs depName=libpax packageName=https://github.com/dbinfrago/libpax gitBranch=master
|
||||||
|
https://github.com/dbinfrago/libpax/archive/3cdc0371c375676a97967547f4065607d4c53fd1.zip
|
||||||
|
# renovate: datasource=github-tags depName=XPowersLib packageName=lewisxhe/XPowersLib
|
||||||
|
https://github.com/lewisxhe/XPowersLib/archive/v0.3.2.zip
|
||||||
|
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||||
|
rweather/Crypto@0.4.0
|
||||||
@@ -10,6 +10,8 @@ custom_meshtastic_tags = M5Stack
|
|||||||
|
|
||||||
extends = esp32c6_base
|
extends = esp32c6_base
|
||||||
board = esp32-c6-devkitc-1
|
board = esp32-c6-devkitc-1
|
||||||
|
board_upload.flash_size = 16MB
|
||||||
|
board_build.partitions = default_16MB.csv
|
||||||
;OpenOCD flash method
|
;OpenOCD flash method
|
||||||
;upload_protocol = esp-builtin
|
;upload_protocol = esp-builtin
|
||||||
;Normal method
|
;Normal method
|
||||||
|
|||||||
21
variants/stm32/russell/platformio.ini
Normal file
21
variants/stm32/russell/platformio.ini
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
; Russell is a board designed to mount on an ER34615/IFR32700 cell and go Up! on a balloon
|
||||||
|
; Hardware repository: https://github.com/Meshtastic-Malaysia/russell
|
||||||
|
; - RAK3172 STM32WLE5CCU6 MCU + integrated SX1262 LoRa
|
||||||
|
; - CDtop CD-PA1010D GPS
|
||||||
|
; - Bosch Sensortec BME280 sensor
|
||||||
|
; - Consonance CN3158 LiFePO4 solar charger
|
||||||
|
[env:russell]
|
||||||
|
extends = stm32_base
|
||||||
|
board = wiscore_rak3172
|
||||||
|
board_level = extra
|
||||||
|
board_upload.maximum_size = 233472 ; reserve the last 28KB for filesystem
|
||||||
|
build_flags =
|
||||||
|
${stm32_base.build_flags}
|
||||||
|
-Ivariants/stm32/russell
|
||||||
|
-DPRIVATE_HW
|
||||||
|
lib_deps =
|
||||||
|
${stm32_base.lib_deps}
|
||||||
|
# renovate: datasource=custom.pio depName=Adafruit BME280 packageName=adafruit/library/Adafruit BME280 Library
|
||||||
|
adafruit/Adafruit BME280 Library@2.3.0
|
||||||
|
|
||||||
|
upload_port = stlink
|
||||||
7
variants/stm32/russell/rfswitch.h
Normal file
7
variants/stm32/russell/rfswitch.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// Pins from https://forum.rakwireless.com/t/rak3172-internal-schematic/4557/2
|
||||||
|
// PB8, PC13
|
||||||
|
|
||||||
|
static const RADIOLIB_PIN_TYPE rfswitch_pins[5] = {PB8, PC13, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
||||||
|
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[4] = {
|
||||||
|
{STM32WLx::MODE_IDLE, {LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, LOW}}, {STM32WLx::MODE_TX_HP, {LOW, HIGH}}, END_OF_MODE_TABLE};
|
||||||
41
variants/stm32/russell/variant.h
Normal file
41
variants/stm32/russell/variant.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#ifndef _VARIANT_RUSSELL_
|
||||||
|
#define _VARIANT_RUSSELL_
|
||||||
|
|
||||||
|
#define USE_STM32WLx
|
||||||
|
|
||||||
|
// I/O
|
||||||
|
#define LED_PIN PA0 // Red LED
|
||||||
|
#define LED_STATE_ON 1
|
||||||
|
#define BUTTON_PIN PH3 // Shared with BOOT0
|
||||||
|
#define BUTTON_NEED_PULLUP
|
||||||
|
// Charger IC charge/standby pins are open-drain with no hardware pull-up:
|
||||||
|
// Internal pull-up is needed on STM32 (TODO)
|
||||||
|
// #define EXT_CHRG_DETECT PA5
|
||||||
|
// #define EXT_PWR_DETECT PA4
|
||||||
|
|
||||||
|
// Bosch Sensortec BME280
|
||||||
|
#define HAS_SENSOR 1
|
||||||
|
|
||||||
|
// CDtop CD-PA1010D
|
||||||
|
#define ENABLE_HWSERIAL1
|
||||||
|
#define PIN_SERIAL1_RX PB7
|
||||||
|
#define PIN_SERIAL1_TX PB6
|
||||||
|
#define HAS_GPS 1
|
||||||
|
#define PIN_GPS_STANDBY PA15
|
||||||
|
#define GPS_RX_PIN PB7
|
||||||
|
#define GPS_TX_PIN PB6
|
||||||
|
|
||||||
|
// LoRa
|
||||||
|
/*
|
||||||
|
* RAK3172 (-20–85°C) -> No TCXO
|
||||||
|
* RAK3172-T (-40–85°C) -> 3.0V TCXO
|
||||||
|
* https://github.com/RAKWireless/RAK-STM32-RUI/blob/e5a28be8fab1a492bd9223dd425ca33a8a297d90/variants/WisDuo_RAK3172-T_Board/radio_conf.h#L91
|
||||||
|
*/
|
||||||
|
#define TCXO_OPTIONAL
|
||||||
|
#define SX126X_DIO3_TCXO_VOLTAGE 3.0
|
||||||
|
|
||||||
|
// Required to avoid Serial1 conflicts due to board definition here:
|
||||||
|
// https://github.com/stm32duino/Arduino_Core_STM32/blob/main/variants/STM32WLxx/WL54CCU_WL55CCU_WLE4C(8-B-C)U_WLE5C(8-B-C)U/variant_RAK3172_MODULE.h
|
||||||
|
#define RAK3172
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user