2022-02-27 00:18:35 -08:00
|
|
|
#include "AdminModule.h"
|
2021-02-26 15:34:00 +08:00
|
|
|
#include "Channels.h"
|
2021-02-21 14:03:44 +08:00
|
|
|
#include "MeshService.h"
|
|
|
|
|
#include "NodeDB.h"
|
2023-02-03 08:50:10 -06:00
|
|
|
#include "PowerFSM.h"
|
2024-08-17 05:52:36 -05:00
|
|
|
#include "RTC.h"
|
2025-01-03 10:05:26 +08:00
|
|
|
#include "SPILock.h"
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
#include "input/InputBroker.h"
|
2024-08-19 11:12:42 -05:00
|
|
|
#include "meshUtils.h"
|
2024-01-29 06:10:48 -06:00
|
|
|
#include <FSCommon.h>
|
2025-06-12 20:58:15 -04:00
|
|
|
#include <ctype.h> // for better whitespace handling
|
2024-03-25 05:33:57 -06:00
|
|
|
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH
|
2022-10-08 11:10:29 +02:00
|
|
|
#include "BleOta.h"
|
2022-10-09 11:19:33 +02:00
|
|
|
#endif
|
2025-03-20 21:39:33 +03:00
|
|
|
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WIFI
|
|
|
|
|
#include "WiFiOTA.h"
|
|
|
|
|
#endif
|
2021-02-21 14:03:44 +08:00
|
|
|
#include "Router.h"
|
2022-05-02 08:53:44 +10:00
|
|
|
#include "configuration.h"
|
2021-02-21 14:03:44 +08:00
|
|
|
#include "main.h"
|
2023-02-03 08:50:10 -06:00
|
|
|
#ifdef ARCH_NRF52
|
|
|
|
|
#include "main.h"
|
|
|
|
|
#endif
|
2022-07-31 07:11:47 -05:00
|
|
|
#ifdef ARCH_PORTDUINO
|
2021-03-18 19:09:31 +08:00
|
|
|
#include "unistd.h"
|
|
|
|
|
#endif
|
2024-12-03 06:17:25 -06:00
|
|
|
|
2024-03-17 08:18:30 -05:00
|
|
|
#include "Default.h"
|
2024-03-26 07:29:07 -05:00
|
|
|
#include "TypeConversions.h"
|
2021-03-18 19:09:31 +08:00
|
|
|
|
2024-03-25 05:33:57 -06:00
|
|
|
#if !MESHTASTIC_EXCLUDE_MQTT
|
2023-02-02 14:11:48 -06:00
|
|
|
#include "mqtt/MQTT.h"
|
2024-03-25 05:33:57 -06:00
|
|
|
#endif
|
2023-02-02 14:11:48 -06:00
|
|
|
|
2024-05-02 20:13:36 +08:00
|
|
|
#if !MESHTASTIC_EXCLUDE_GPS
|
|
|
|
|
#include "GPS.h"
|
|
|
|
|
#endif
|
2024-06-06 22:19:40 +09:30
|
|
|
|
|
|
|
|
#if MESHTASTIC_EXCLUDE_GPS
|
|
|
|
|
#include "modules/PositionModule.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-05-07 18:38:42 -05:00
|
|
|
#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C
|
2024-09-25 21:25:31 +10:00
|
|
|
#include "motion/AccelerometerThread.h"
|
2024-05-16 17:27:36 -05:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2) && \
|
|
|
|
|
!defined(CONFIG_IDF_TARGET_ESP32C3)
|
2025-07-26 19:55:54 -05:00
|
|
|
#include "SerialModule.h"
|
|
|
|
|
#endif
|
2024-05-02 20:13:36 +08:00
|
|
|
|
2022-02-27 02:21:02 -08:00
|
|
|
AdminModule *adminModule;
|
2022-11-20 19:50:45 -06:00
|
|
|
bool hasOpenEditTransaction;
|
2021-02-21 14:03:44 +08:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
/// A special reserved string to indicate strings we can not share with external nodes. We will use this 'reserved' word instead.
|
|
|
|
|
/// Also, to make setting work correctly, if someone tries to set a string to this reserved value we assume they don't really want
|
|
|
|
|
/// a change.
|
2021-08-01 11:21:36 -07:00
|
|
|
static const char *secretReserved = "sekrit";
|
|
|
|
|
|
|
|
|
|
/// If buf is the reserved secret word, replace the buffer with currentVal
|
2026-01-04 12:15:53 +01:00
|
|
|
static void writeSecret(char *buf, size_t bufsz, const char *currentVal)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(buf, secretReserved) == 0) {
|
|
|
|
|
strncpy(buf, currentVal, bufsz);
|
|
|
|
|
}
|
2021-08-01 11:21:36 -07:00
|
|
|
}
|
|
|
|
|
|
2022-05-02 22:00:24 +10:00
|
|
|
/**
|
2023-05-01 16:10:27 -05:00
|
|
|
* @brief Handle received protobuf message
|
2022-05-02 22:00:24 +10:00
|
|
|
*
|
2023-05-01 16:10:27 -05:00
|
|
|
* @param mp Received MeshPacket
|
2022-05-02 22:00:24 +10:00
|
|
|
* @param r Decoded AdminMessage
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2026-01-04 12:15:53 +01:00
|
|
|
bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *r)
|
|
|
|
|
{
|
|
|
|
|
// if handled == false, then let others look at this message also if they want
|
|
|
|
|
bool handled = false;
|
|
|
|
|
assert(r);
|
|
|
|
|
bool fromOthers = !isFromUs(&mp);
|
|
|
|
|
if (mp.which_payload_variant != meshtastic_MeshPacket_decoded_tag) {
|
|
|
|
|
return handled;
|
|
|
|
|
}
|
|
|
|
|
meshtastic_Channel *ch = &channels.getByIndex(mp.channel);
|
|
|
|
|
// Could tighten this up further by tracking the last public_key we went an AdminMessage request to
|
|
|
|
|
// and only allowing responses from that remote.
|
|
|
|
|
if (messageIsResponse(r)) {
|
|
|
|
|
LOG_DEBUG("Allow admin response message");
|
|
|
|
|
} else if (mp.from == 0) {
|
|
|
|
|
if (config.security.is_managed) {
|
|
|
|
|
LOG_INFO("Ignore local admin payload because is_managed");
|
|
|
|
|
return handled;
|
|
|
|
|
}
|
|
|
|
|
} else if (strcasecmp(ch->settings.name, Channels::adminChannel) == 0) {
|
|
|
|
|
if (!config.security.admin_channel_enabled) {
|
|
|
|
|
LOG_INFO("Ignore admin channel, legacy admin is disabled");
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
|
|
|
|
|
return handled;
|
|
|
|
|
}
|
|
|
|
|
} else if (mp.pki_encrypted) {
|
|
|
|
|
if ((config.security.admin_key[0].size == 32 &&
|
|
|
|
|
memcmp(mp.public_key.bytes, config.security.admin_key[0].bytes, 32) == 0) ||
|
|
|
|
|
(config.security.admin_key[1].size == 32 &&
|
|
|
|
|
memcmp(mp.public_key.bytes, config.security.admin_key[1].bytes, 32) == 0) ||
|
|
|
|
|
(config.security.admin_key[2].size == 32 &&
|
|
|
|
|
memcmp(mp.public_key.bytes, config.security.admin_key[2].bytes, 32) == 0)) {
|
|
|
|
|
LOG_INFO("PKC admin payload with authorized sender key");
|
|
|
|
|
|
|
|
|
|
// Automatically favorite the node that is using the admin key
|
|
|
|
|
auto remoteNode = nodeDB->getMeshNode(mp.from);
|
|
|
|
|
if (remoteNode && !remoteNode->is_favorite) {
|
|
|
|
|
if (config.device.role == meshtastic_Config_DeviceConfig_Role_CLIENT_BASE) {
|
|
|
|
|
// Special case for CLIENT_BASE: is_favorite has special meaning, and we don't want to automatically set it
|
|
|
|
|
// without the user doing so deliberately.
|
|
|
|
|
LOG_INFO("PKC admin valid, but not auto-favoriting node %x because role==CLIENT_BASE", mp.from);
|
|
|
|
|
} else {
|
|
|
|
|
LOG_INFO("PKC admin valid. Auto-favoriting node %x", mp.from);
|
|
|
|
|
remoteNode->is_favorite = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-17 21:09:24 -05:00
|
|
|
} else {
|
2026-01-04 12:15:53 +01:00
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_ADMIN_PUBLIC_KEY_UNAUTHORIZED, &mp);
|
|
|
|
|
LOG_INFO("Received PKC admin payload, but the sender public key does not match the admin authorized key!");
|
|
|
|
|
return handled;
|
2024-09-17 21:09:24 -05:00
|
|
|
}
|
|
|
|
|
} else {
|
2026-01-04 12:15:53 +01:00
|
|
|
LOG_INFO("Ignore unauthorized admin payload %i", r->which_payload_variant);
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
|
|
|
|
|
return handled;
|
2024-08-17 08:41:12 -05:00
|
|
|
}
|
2026-01-04 12:15:53 +01:00
|
|
|
|
|
|
|
|
LOG_INFO("Handle admin payload %i", r->which_payload_variant);
|
|
|
|
|
|
|
|
|
|
// all of the get and set messages, including those for other modules, flow through here first.
|
|
|
|
|
// any message that changes state, we want to check the passkey for
|
|
|
|
|
if (mp.from != 0 && !messageIsRequest(r) && !messageIsResponse(r)) {
|
|
|
|
|
if (!checkPassKey(r)) {
|
|
|
|
|
LOG_WARN("Admin message without session_key!");
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_ADMIN_BAD_SESSION_KEY, &mp);
|
|
|
|
|
return handled;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
switch (r->which_payload_variant) {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Getters
|
|
|
|
|
*/
|
|
|
|
|
case meshtastic_AdminMessage_get_owner_request_tag:
|
|
|
|
|
LOG_DEBUG("Client got owner");
|
|
|
|
|
handleGetOwner(mp);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case meshtastic_AdminMessage_get_config_request_tag:
|
|
|
|
|
LOG_DEBUG("Client got config");
|
|
|
|
|
handleGetConfig(mp, r->get_config_request);
|
2021-02-26 15:34:00 +08:00
|
|
|
break;
|
2026-01-04 12:15:53 +01:00
|
|
|
|
|
|
|
|
case meshtastic_AdminMessage_get_module_config_request_tag:
|
|
|
|
|
LOG_DEBUG("Client got module config");
|
|
|
|
|
handleGetModuleConfig(mp, r->get_module_config_request);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case meshtastic_AdminMessage_get_channel_request_tag: {
|
|
|
|
|
uint32_t i = r->get_channel_request - 1;
|
|
|
|
|
LOG_DEBUG("Client got channel %u", i);
|
|
|
|
|
if (i >= MAX_NUM_CHANNELS)
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
|
|
|
|
else
|
|
|
|
|
handleGetChannel(mp, i);
|
2021-02-26 15:34:00 +08:00
|
|
|
break;
|
2021-03-23 11:44:51 +08:00
|
|
|
}
|
2021-02-26 15:34:00 +08:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
/**
|
|
|
|
|
* Setters
|
|
|
|
|
*/
|
|
|
|
|
case meshtastic_AdminMessage_set_owner_tag:
|
|
|
|
|
LOG_DEBUG("Client set owner");
|
|
|
|
|
// Validate names
|
|
|
|
|
if (*r->set_owner.long_name) {
|
|
|
|
|
const char *start = r->set_owner.long_name;
|
|
|
|
|
// Skip all whitespace (space, tab, newline, etc)
|
|
|
|
|
while (*start && isspace((unsigned char)*start))
|
|
|
|
|
start++;
|
|
|
|
|
if (*start == '\0') {
|
|
|
|
|
LOG_WARN("Rejected long_name: must contain at least 1 non-whitespace character");
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (*r->set_owner.short_name) {
|
|
|
|
|
const char *start = r->set_owner.short_name;
|
|
|
|
|
while (*start && isspace((unsigned char)*start))
|
|
|
|
|
start++;
|
|
|
|
|
if (*start == '\0') {
|
|
|
|
|
LOG_WARN("Rejected short_name: must contain at least 1 non-whitespace character");
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
handleSetOwner(r->set_owner);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case meshtastic_AdminMessage_set_config_tag:
|
|
|
|
|
LOG_DEBUG("Client set config");
|
|
|
|
|
handleSetConfig(r->set_config);
|
|
|
|
|
break;
|
2022-05-02 08:53:44 +10:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
case meshtastic_AdminMessage_set_module_config_tag:
|
|
|
|
|
LOG_DEBUG("Client set module config");
|
|
|
|
|
if (!handleSetModuleConfig(r->set_module_config)) {
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case meshtastic_AdminMessage_set_channel_tag:
|
|
|
|
|
LOG_DEBUG("Client set channel %d", r->set_channel.index);
|
|
|
|
|
if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS)
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
|
|
|
|
else
|
|
|
|
|
handleSetChannel(r->set_channel);
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_set_ham_mode_tag:
|
|
|
|
|
LOG_DEBUG("Client set ham mode");
|
|
|
|
|
handleSetHamMode(r->set_ham_mode);
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_get_ui_config_request_tag: {
|
|
|
|
|
LOG_DEBUG("Client is getting device-ui config");
|
|
|
|
|
handleGetDeviceUIConfig(mp);
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
2024-12-27 10:46:21 +11:00
|
|
|
}
|
2022-05-02 22:00:24 +10:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
/**
|
|
|
|
|
* Other
|
|
|
|
|
*/
|
|
|
|
|
case meshtastic_AdminMessage_reboot_seconds_tag: {
|
|
|
|
|
reboot(r->reboot_seconds);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_reboot_ota_seconds_tag: {
|
|
|
|
|
int32_t s = r->reboot_ota_seconds;
|
2025-03-20 21:39:33 +03:00
|
|
|
#if defined(ARCH_ESP32)
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_BLUETOOTH
|
2026-01-04 12:15:53 +01:00
|
|
|
if (!BleOta::getOtaAppVersion().isEmpty()) {
|
|
|
|
|
if (screen)
|
|
|
|
|
screen->startFirmwareUpdateScreen();
|
|
|
|
|
BleOta::switchToOtaApp();
|
|
|
|
|
LOG_INFO("Rebooting to BLE OTA");
|
|
|
|
|
}
|
2022-10-09 11:35:19 +02:00
|
|
|
#endif
|
2025-03-20 21:39:33 +03:00
|
|
|
#if !MESHTASTIC_EXCLUDE_WIFI
|
2026-01-04 12:15:53 +01:00
|
|
|
if (WiFiOTA::trySwitchToOTA()) {
|
|
|
|
|
if (screen)
|
|
|
|
|
screen->startFirmwareUpdateScreen();
|
|
|
|
|
WiFiOTA::saveConfig(&config.network);
|
|
|
|
|
LOG_INFO("Rebooting to WiFi OTA");
|
|
|
|
|
}
|
2025-03-20 21:39:33 +03:00
|
|
|
#endif
|
|
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
LOG_INFO("Reboot in %d seconds", s);
|
|
|
|
|
rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_shutdown_seconds_tag: {
|
|
|
|
|
int32_t s = r->shutdown_seconds;
|
|
|
|
|
LOG_INFO("Shutdown in %d seconds", s);
|
|
|
|
|
shutdownAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_get_device_metadata_request_tag: {
|
|
|
|
|
LOG_INFO("Client got device metadata");
|
|
|
|
|
handleGetDeviceMetadata(mp);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_factory_reset_config_tag: {
|
|
|
|
|
disableBluetooth();
|
|
|
|
|
LOG_INFO("Initiate factory config reset");
|
|
|
|
|
nodeDB->factoryReset();
|
|
|
|
|
LOG_INFO("Factory config reset finished, rebooting soon");
|
|
|
|
|
reboot(DEFAULT_REBOOT_SECONDS);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_factory_reset_device_tag: {
|
|
|
|
|
disableBluetooth();
|
|
|
|
|
LOG_INFO("Initiate full factory reset");
|
|
|
|
|
nodeDB->factoryReset(true);
|
|
|
|
|
reboot(DEFAULT_REBOOT_SECONDS);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_nodedb_reset_tag: {
|
|
|
|
|
disableBluetooth();
|
|
|
|
|
LOG_INFO("Initiate node-db reset");
|
|
|
|
|
// CLIENT_BASE, ROUTER and ROUTER_LATE are able to preserve the remaining hop count when relaying a packet via a
|
|
|
|
|
// favorited node, so ensure that their favorites are kept on reset
|
|
|
|
|
bool rolePreference =
|
|
|
|
|
isOneOf(config.device.role, meshtastic_Config_DeviceConfig_Role_CLIENT_BASE,
|
|
|
|
|
meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_ROUTER_LATE);
|
|
|
|
|
nodeDB->resetNodes(rolePreference ? rolePreference : r->nodedb_reset);
|
|
|
|
|
reboot(DEFAULT_REBOOT_SECONDS);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_store_ui_config_tag: {
|
|
|
|
|
LOG_INFO("Storing device-ui config");
|
|
|
|
|
handleStoreDeviceUIConfig(r->store_ui_config);
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_begin_edit_settings_tag: {
|
|
|
|
|
LOG_INFO("Begin transaction for editing settings");
|
|
|
|
|
hasOpenEditTransaction = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_commit_edit_settings_tag: {
|
|
|
|
|
disableBluetooth();
|
|
|
|
|
LOG_INFO("Commit transaction for edited settings");
|
|
|
|
|
hasOpenEditTransaction = false;
|
|
|
|
|
saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS | SEGMENT_NODEDATABASE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_get_device_connection_status_request_tag: {
|
|
|
|
|
LOG_INFO("Client got device connection status");
|
|
|
|
|
handleGetDeviceConnectionStatus(mp);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_get_module_config_response_tag: {
|
|
|
|
|
LOG_INFO("Client received a get_module_config response");
|
|
|
|
|
if (fromOthers && r->get_module_config_response.which_payload_variant ==
|
|
|
|
|
meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG) {
|
|
|
|
|
handleGetModuleConfigResponse(mp, r);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_remove_by_nodenum_tag: {
|
|
|
|
|
LOG_INFO("Client received remove_nodenum command");
|
|
|
|
|
nodeDB->removeNodeByNum(r->remove_by_nodenum);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_add_contact_tag: {
|
|
|
|
|
LOG_INFO("Client received add_contact command");
|
|
|
|
|
nodeDB->addFromContact(r->add_contact);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_set_favorite_node_tag: {
|
|
|
|
|
LOG_INFO("Client received set_favorite_node command");
|
|
|
|
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node);
|
|
|
|
|
if (node != NULL) {
|
|
|
|
|
node->is_favorite = true;
|
|
|
|
|
saveChanges(SEGMENT_NODEDATABASE, false);
|
|
|
|
|
if (screen)
|
|
|
|
|
screen->setFrames(graphics::Screen::FOCUS_PRESERVE); // <-- Rebuild screens
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_remove_favorite_node_tag: {
|
|
|
|
|
LOG_INFO("Client received remove_favorite_node command");
|
|
|
|
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node);
|
|
|
|
|
if (node != NULL) {
|
|
|
|
|
node->is_favorite = false;
|
|
|
|
|
saveChanges(SEGMENT_NODEDATABASE, false);
|
|
|
|
|
if (screen)
|
|
|
|
|
screen->setFrames(graphics::Screen::FOCUS_PRESERVE); // <-- Rebuild screens
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_set_ignored_node_tag: {
|
|
|
|
|
LOG_INFO("Client received set_ignored_node command");
|
|
|
|
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_ignored_node);
|
|
|
|
|
if (node != NULL) {
|
|
|
|
|
node->is_ignored = true;
|
|
|
|
|
node->has_device_metrics = false;
|
|
|
|
|
node->has_position = false;
|
|
|
|
|
node->user.public_key.size = 0;
|
|
|
|
|
node->user.public_key.bytes[0] = 0;
|
|
|
|
|
saveChanges(SEGMENT_NODEDATABASE, false);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_remove_ignored_node_tag: {
|
|
|
|
|
LOG_INFO("Client received remove_ignored_node command");
|
|
|
|
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_ignored_node);
|
|
|
|
|
if (node != NULL) {
|
|
|
|
|
node->is_ignored = false;
|
|
|
|
|
saveChanges(SEGMENT_NODEDATABASE, false);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2026-01-12 04:59:51 +00:00
|
|
|
case meshtastic_AdminMessage_toggle_muted_node_tag: {
|
|
|
|
|
LOG_INFO("Client received toggle_muted_node command");
|
|
|
|
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->toggle_muted_node);
|
|
|
|
|
if (node != NULL) {
|
|
|
|
|
node->bitfield ^= (1 << NODEINFO_BITFIELD_IS_MUTED_SHIFT);
|
|
|
|
|
saveChanges(SEGMENT_NODEDATABASE, false);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
case meshtastic_AdminMessage_set_fixed_position_tag: {
|
|
|
|
|
LOG_INFO("Client received set_fixed_position command");
|
|
|
|
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
|
|
|
|
node->has_position = true;
|
|
|
|
|
node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position);
|
|
|
|
|
nodeDB->setLocalPosition(r->set_fixed_position);
|
|
|
|
|
config.position.fixed_position = true;
|
|
|
|
|
saveChanges(SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false);
|
2024-05-02 20:13:36 +08:00
|
|
|
#if !MESHTASTIC_EXCLUDE_GPS
|
2026-01-04 12:15:53 +01:00
|
|
|
if (gps != nullptr)
|
|
|
|
|
gps->enable();
|
|
|
|
|
// Send our new fixed position to the mesh for good measure
|
|
|
|
|
positionModule->sendOurPosition();
|
2024-07-05 15:58:16 +02:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_remove_fixed_position_tag: {
|
|
|
|
|
LOG_INFO("Client received remove_fixed_position command");
|
|
|
|
|
nodeDB->clearLocalPosition();
|
|
|
|
|
config.position.fixed_position = false;
|
|
|
|
|
saveChanges(SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_set_time_only_tag: {
|
|
|
|
|
LOG_INFO("Client received set_time_only command");
|
|
|
|
|
struct timeval tv;
|
|
|
|
|
tv.tv_sec = r->set_time_only;
|
|
|
|
|
tv.tv_usec = 0;
|
|
|
|
|
|
|
|
|
|
perhapsSetRTC(RTCQualityNTP, &tv, false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_enter_dfu_mode_request_tag: {
|
|
|
|
|
LOG_INFO("Client requesting to enter DFU mode");
|
2025-12-14 14:50:41 -06:00
|
|
|
#if HAS_SCREEN
|
2026-01-04 12:15:53 +01:00
|
|
|
IF_SCREEN(screen->showSimpleBanner("Device is rebooting\ninto DFU mode.", 0));
|
2025-12-14 14:50:41 -06:00
|
|
|
#endif
|
2024-01-06 14:39:27 -06:00
|
|
|
#if defined(ARCH_NRF52) || defined(ARCH_RP2040)
|
2026-01-04 12:15:53 +01:00
|
|
|
enterDfuMode();
|
2023-12-27 14:26:40 -06:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_delete_file_request_tag: {
|
|
|
|
|
LOG_DEBUG("Client requesting to delete file: %s", r->delete_file_request);
|
2025-01-03 10:05:26 +08:00
|
|
|
|
2024-07-26 03:16:21 +02:00
|
|
|
#ifdef FSCom
|
2026-01-04 12:15:53 +01:00
|
|
|
spiLock->lock();
|
|
|
|
|
if (FSCom.remove(r->delete_file_request)) {
|
|
|
|
|
LOG_DEBUG("Successfully deleted file");
|
|
|
|
|
} else {
|
|
|
|
|
LOG_DEBUG("Failed to delete file");
|
|
|
|
|
}
|
|
|
|
|
spiLock->unlock();
|
2024-07-26 03:16:21 +02:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
break;
|
2024-01-29 06:10:48 -06:00
|
|
|
}
|
2026-01-04 12:15:53 +01:00
|
|
|
case meshtastic_AdminMessage_backup_preferences_tag: {
|
|
|
|
|
LOG_INFO("Client requesting to backup preferences");
|
|
|
|
|
if (nodeDB->backupPreferences(r->backup_preferences)) {
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
|
|
|
|
|
} else {
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
|
|
|
|
}
|
|
|
|
|
break;
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
}
|
2026-01-04 12:15:53 +01:00
|
|
|
case meshtastic_AdminMessage_restore_preferences_tag: {
|
|
|
|
|
LOG_INFO("Client requesting to restore preferences");
|
|
|
|
|
if (nodeDB->restorePreferences(r->backup_preferences,
|
|
|
|
|
SEGMENT_DEVICESTATE | SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_CHANNELS)) {
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
|
|
|
|
|
LOG_DEBUG("Rebooting after successful restore of preferences");
|
|
|
|
|
reboot(1000);
|
|
|
|
|
disableBluetooth();
|
|
|
|
|
} else {
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_remove_backup_preferences_tag: {
|
|
|
|
|
LOG_INFO("Client requesting to remove backup preferences");
|
|
|
|
|
#ifdef FSCom
|
|
|
|
|
if (r->remove_backup_preferences == meshtastic_AdminMessage_BackupLocation_FLASH) {
|
|
|
|
|
spiLock->lock();
|
|
|
|
|
FSCom.remove(backupFileName);
|
|
|
|
|
spiLock->unlock();
|
|
|
|
|
} else if (r->remove_backup_preferences == meshtastic_AdminMessage_BackupLocation_SD) {
|
|
|
|
|
// TODO: After more mainline SD card support
|
|
|
|
|
LOG_ERROR("SD backup removal not implemented yet");
|
|
|
|
|
}
|
2026-01-03 21:19:24 +01:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_AdminMessage_send_input_event_tag: {
|
|
|
|
|
LOG_INFO("Client requesting to send input event");
|
|
|
|
|
handleSendInputEvent(r->send_input_event);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-07-31 07:11:47 -05:00
|
|
|
#ifdef ARCH_PORTDUINO
|
2026-01-04 12:15:53 +01:00
|
|
|
case meshtastic_AdminMessage_exit_simulator_tag:
|
|
|
|
|
LOG_INFO("Exiting simulator");
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
2021-03-18 19:09:31 +08:00
|
|
|
#endif
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
default:
|
|
|
|
|
meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default;
|
|
|
|
|
AdminMessageHandleResult handleResult = MeshModule::handleAdminMessageForAllModules(mp, r, &res);
|
|
|
|
|
|
|
|
|
|
if (handleResult == AdminMessageHandleResult::HANDLED_WITH_RESPONSE) {
|
|
|
|
|
setPassKey(&res);
|
|
|
|
|
myReply = allocDataProtobuf(res);
|
|
|
|
|
} else if (mp.decoded.want_response) {
|
|
|
|
|
LOG_DEBUG("Module API did not respond to admin message. req.variant=%d", r->which_payload_variant);
|
|
|
|
|
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
|
|
|
|
|
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
|
|
|
|
LOG_DEBUG("Module API did not handle admin message %d", r->which_payload_variant);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Allow any observers (e.g. the UI) to handle/respond
|
|
|
|
|
AdminMessageHandleResult observerResult = AdminMessageHandleResult::NOT_HANDLED;
|
|
|
|
|
meshtastic_AdminMessage observerResponse = meshtastic_AdminMessage_init_default;
|
|
|
|
|
AdminModule_ObserverData observerData = {
|
|
|
|
|
.request = r,
|
|
|
|
|
.response = &observerResponse,
|
|
|
|
|
.result = &observerResult,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
notifyObservers(&observerData);
|
|
|
|
|
|
|
|
|
|
if (observerResult == AdminMessageHandleResult::HANDLED_WITH_RESPONSE) {
|
|
|
|
|
setPassKey(&observerResponse);
|
|
|
|
|
myReply = allocDataProtobuf(observerResponse);
|
|
|
|
|
LOG_DEBUG("Observer responded to admin message");
|
|
|
|
|
} else if (observerResult == AdminMessageHandleResult::HANDLED) {
|
|
|
|
|
LOG_DEBUG("Observer handled admin message");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If asked for a response and it is not yet set, generate an 'ACK' response
|
|
|
|
|
if (mp.decoded.want_response && !myReply) {
|
|
|
|
|
myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp);
|
|
|
|
|
}
|
|
|
|
|
if (mp.pki_encrypted && myReply) {
|
|
|
|
|
myReply->pki_encrypted = true;
|
|
|
|
|
}
|
|
|
|
|
return handled;
|
2021-02-21 14:03:44 +08:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleGetModuleConfigResponse(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *r)
|
|
|
|
|
{
|
|
|
|
|
// Skip if it's disabled or no pins are exposed
|
|
|
|
|
if (!r->get_module_config_response.payload_variant.remote_hardware.enabled ||
|
|
|
|
|
r->get_module_config_response.payload_variant.remote_hardware.available_pins_count == 0) {
|
|
|
|
|
LOG_DEBUG("Remote hardware module disabled or no available_pins. Skip");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) {
|
|
|
|
|
if (devicestate.node_remote_hardware_pins[i].node_num == 0 || !devicestate.node_remote_hardware_pins[i].has_pin) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (uint8_t j = 0; j < r->get_module_config_response.payload_variant.remote_hardware.available_pins_count; j++) {
|
|
|
|
|
auto availablePin = r->get_module_config_response.payload_variant.remote_hardware.available_pins[j];
|
|
|
|
|
if (i < devicestate.node_remote_hardware_pins_count) {
|
|
|
|
|
devicestate.node_remote_hardware_pins[i].node_num = mp.from;
|
|
|
|
|
devicestate.node_remote_hardware_pins[i].pin = availablePin;
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-22 07:00:20 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-02 22:00:24 +10:00
|
|
|
/**
|
|
|
|
|
* Setter methods
|
|
|
|
|
*/
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleSetOwner(const meshtastic_User &o)
|
|
|
|
|
{
|
|
|
|
|
int changed = 0;
|
2021-02-21 14:03:44 +08:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
if (*o.long_name) {
|
|
|
|
|
changed |= strcmp(owner.long_name, o.long_name);
|
|
|
|
|
strncpy(owner.long_name, o.long_name, sizeof(owner.long_name));
|
|
|
|
|
}
|
|
|
|
|
if (*o.short_name) {
|
|
|
|
|
changed |= strcmp(owner.short_name, o.short_name);
|
|
|
|
|
strncpy(owner.short_name, o.short_name, sizeof(owner.short_name));
|
|
|
|
|
}
|
|
|
|
|
snprintf(owner.id, sizeof(owner.id), "!%08x", nodeDB->getNodeNum());
|
2026-01-03 21:19:24 +01:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
if (owner.is_licensed != o.is_licensed) {
|
|
|
|
|
changed = 1;
|
|
|
|
|
owner.is_licensed = o.is_licensed;
|
|
|
|
|
if (channels.ensureLicensedOperation()) {
|
|
|
|
|
sendWarning(licensedModeMessage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (owner.has_is_unmessagable != o.has_is_unmessagable ||
|
|
|
|
|
(o.has_is_unmessagable && owner.is_unmessagable != o.is_unmessagable)) {
|
|
|
|
|
changed = 1;
|
|
|
|
|
owner.has_is_unmessagable = owner.has_is_unmessagable || o.has_is_unmessagable;
|
|
|
|
|
owner.is_unmessagable = o.is_unmessagable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (changed) { // If nothing really changed, don't broadcast on the network or write to flash
|
|
|
|
|
service->reloadOwner(!hasOpenEditTransaction);
|
|
|
|
|
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE);
|
2026-01-03 21:19:24 +01:00
|
|
|
}
|
2026-01-04 12:15:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|
|
|
|
{
|
|
|
|
|
auto changes = SEGMENT_CONFIG;
|
|
|
|
|
auto existingRole = config.device.role;
|
|
|
|
|
bool isRegionUnset = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
|
|
|
|
|
bool requiresReboot = true;
|
|
|
|
|
|
|
|
|
|
switch (c.which_payload_variant) {
|
|
|
|
|
case meshtastic_Config_device_tag:
|
|
|
|
|
LOG_INFO("Set config: Device");
|
|
|
|
|
config.has_device = true;
|
|
|
|
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
|
|
|
|
if (config.device.double_tap_as_button_press == false && c.payload_variant.device.double_tap_as_button_press == true &&
|
|
|
|
|
accelerometerThread->enabled == false) {
|
|
|
|
|
config.device.double_tap_as_button_press = c.payload_variant.device.double_tap_as_button_press;
|
|
|
|
|
accelerometerThread->enabled = true;
|
|
|
|
|
accelerometerThread->start();
|
|
|
|
|
}
|
2024-05-16 17:27:36 -05:00
|
|
|
#endif
|
|
|
|
|
#ifdef LED_PIN
|
2026-01-04 12:15:53 +01:00
|
|
|
// Turn LED off if heartbeat by config
|
|
|
|
|
if (c.payload_variant.device.led_heartbeat_disabled) {
|
|
|
|
|
digitalWrite(LED_PIN, HIGH ^ LED_STATE_ON);
|
|
|
|
|
}
|
2024-05-16 17:27:36 -05:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
if (config.device.button_gpio == c.payload_variant.device.button_gpio &&
|
|
|
|
|
config.device.buzzer_gpio == c.payload_variant.device.buzzer_gpio &&
|
|
|
|
|
config.device.role == c.payload_variant.device.role &&
|
|
|
|
|
config.device.rebroadcast_mode == c.payload_variant.device.rebroadcast_mode) {
|
|
|
|
|
requiresReboot = false;
|
|
|
|
|
}
|
|
|
|
|
config.device = c.payload_variant.device;
|
|
|
|
|
if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_NONE &&
|
|
|
|
|
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) {
|
|
|
|
|
config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_ALL;
|
|
|
|
|
const char *warning = "Rebroadcast mode can't be set to NONE for a router";
|
|
|
|
|
LOG_WARN(warning);
|
|
|
|
|
sendWarning(warning);
|
|
|
|
|
}
|
|
|
|
|
// If we're setting router role for the first time, install its intervals
|
|
|
|
|
if (existingRole != c.payload_variant.device.role) {
|
|
|
|
|
nodeDB->installRoleDefaults(c.payload_variant.device.role);
|
|
|
|
|
changes |= SEGMENT_NODEDATABASE | SEGMENT_DEVICESTATE; // Some role defaults affect owner
|
|
|
|
|
}
|
|
|
|
|
if (config.device.node_info_broadcast_secs < min_node_info_broadcast_secs) {
|
|
|
|
|
LOG_DEBUG("Tried to set node_info_broadcast_secs too low, setting to %d", min_node_info_broadcast_secs);
|
|
|
|
|
config.device.node_info_broadcast_secs = min_node_info_broadcast_secs;
|
|
|
|
|
}
|
|
|
|
|
// Router Client and Repeater deprecated; Set it to client
|
|
|
|
|
if (IS_ONE_OF(c.payload_variant.device.role, meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT,
|
|
|
|
|
meshtastic_Config_DeviceConfig_Role_REPEATER)) {
|
|
|
|
|
config.device.role = meshtastic_Config_DeviceConfig_Role_CLIENT;
|
|
|
|
|
if (moduleConfig.store_forward.enabled && !moduleConfig.store_forward.is_server) {
|
|
|
|
|
moduleConfig.store_forward.is_server = true;
|
|
|
|
|
changes |= SEGMENT_MODULECONFIG;
|
|
|
|
|
requiresReboot = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-02 06:14:24 -05:00
|
|
|
#if USERPREFS_EVENT_MODE
|
2026-01-04 12:15:53 +01:00
|
|
|
// If we're in event mode, nobody is a Router or Router Late
|
|
|
|
|
if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ||
|
|
|
|
|
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE) {
|
|
|
|
|
config.device.role = meshtastic_Config_DeviceConfig_Role_CLIENT;
|
|
|
|
|
}
|
2024-07-29 20:16:47 -05:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
break;
|
|
|
|
|
case meshtastic_Config_position_tag:
|
|
|
|
|
LOG_INFO("Set config: Position");
|
|
|
|
|
config.has_position = true;
|
|
|
|
|
// If we have turned off the GPS (disabled or not present) and we're not using fixed position,
|
|
|
|
|
// clear the stored position since it may not get updated
|
|
|
|
|
if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED &&
|
|
|
|
|
c.payload_variant.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED &&
|
|
|
|
|
config.position.fixed_position == false && c.payload_variant.position.fixed_position == false) {
|
|
|
|
|
nodeDB->clearLocalPosition();
|
|
|
|
|
saveChanges(SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false);
|
|
|
|
|
}
|
|
|
|
|
config.position = c.payload_variant.position;
|
|
|
|
|
|
|
|
|
|
// Save nodedb as well in case we got a fixed position packet
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_Config_power_tag:
|
|
|
|
|
LOG_INFO("Set config: Power");
|
|
|
|
|
config.has_power = true;
|
|
|
|
|
// Really just the adc override is the only thing that can change without a reboot
|
|
|
|
|
if (config.power.device_battery_ina_address == c.payload_variant.power.device_battery_ina_address &&
|
|
|
|
|
config.power.is_power_saving == c.payload_variant.power.is_power_saving &&
|
|
|
|
|
config.power.ls_secs == c.payload_variant.power.ls_secs &&
|
|
|
|
|
config.power.min_wake_secs == c.payload_variant.power.min_wake_secs &&
|
|
|
|
|
config.power.on_battery_shutdown_after_secs == c.payload_variant.power.on_battery_shutdown_after_secs &&
|
|
|
|
|
config.power.sds_secs == c.payload_variant.power.sds_secs &&
|
|
|
|
|
config.power.wait_bluetooth_secs == c.payload_variant.power.wait_bluetooth_secs) {
|
|
|
|
|
requiresReboot = false;
|
|
|
|
|
}
|
|
|
|
|
config.power = c.payload_variant.power;
|
|
|
|
|
if (c.payload_variant.power.on_battery_shutdown_after_secs > 0 &&
|
|
|
|
|
c.payload_variant.power.on_battery_shutdown_after_secs < 30) {
|
|
|
|
|
LOG_WARN("Tried to set on_battery_shutdown_after_secs too low, set to min 30 seconds");
|
|
|
|
|
config.power.on_battery_shutdown_after_secs = 30;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_Config_network_tag:
|
|
|
|
|
LOG_INFO("Set config: WiFi");
|
|
|
|
|
config.has_network = true;
|
|
|
|
|
config.network = c.payload_variant.network;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_Config_display_tag:
|
|
|
|
|
LOG_INFO("Set config: Display");
|
|
|
|
|
config.has_display = true;
|
|
|
|
|
if (config.display.screen_on_secs == c.payload_variant.display.screen_on_secs &&
|
|
|
|
|
config.display.flip_screen == c.payload_variant.display.flip_screen &&
|
|
|
|
|
config.display.oled == c.payload_variant.display.oled &&
|
|
|
|
|
config.display.displaymode == c.payload_variant.display.displaymode) {
|
|
|
|
|
requiresReboot = false;
|
|
|
|
|
} else if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR &&
|
|
|
|
|
c.payload_variant.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
|
|
|
|
|
config.bluetooth.enabled = false;
|
|
|
|
|
}
|
2024-05-16 17:27:36 -05:00
|
|
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
2026-01-04 12:15:53 +01:00
|
|
|
if (config.display.wake_on_tap_or_motion == false && c.payload_variant.display.wake_on_tap_or_motion == true &&
|
|
|
|
|
accelerometerThread->enabled == false) {
|
|
|
|
|
config.display.wake_on_tap_or_motion = c.payload_variant.display.wake_on_tap_or_motion;
|
|
|
|
|
accelerometerThread->enabled = true;
|
|
|
|
|
accelerometerThread->start();
|
|
|
|
|
}
|
2024-05-16 17:27:36 -05:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
config.display = c.payload_variant.display;
|
|
|
|
|
break;
|
2025-09-28 13:13:07 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
case meshtastic_Config_lora_tag: {
|
|
|
|
|
// Wrap the entire case in a block to scope variables and avoid crossing initialization
|
|
|
|
|
auto oldLoraConfig = config.lora;
|
|
|
|
|
auto validatedLora = c.payload_variant.lora;
|
2025-09-28 13:13:07 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
LOG_INFO("Set config: LoRa");
|
|
|
|
|
config.has_lora = true;
|
2025-09-28 13:13:07 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
if (validatedLora.coding_rate < 4 || validatedLora.coding_rate > 8) {
|
|
|
|
|
LOG_WARN("Invalid coding_rate %d, setting to 5", validatedLora.coding_rate);
|
|
|
|
|
validatedLora.coding_rate = 5;
|
|
|
|
|
}
|
2025-09-28 13:13:07 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
if (validatedLora.spread_factor < 7 || validatedLora.spread_factor > 12) {
|
|
|
|
|
LOG_WARN("Invalid spread_factor %d, setting to 11", validatedLora.spread_factor);
|
|
|
|
|
validatedLora.spread_factor = 11;
|
|
|
|
|
}
|
2025-09-28 13:13:07 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
if (validatedLora.bandwidth == 0) {
|
|
|
|
|
int originalBandwidth = validatedLora.bandwidth;
|
|
|
|
|
validatedLora.bandwidth = myRegion->wideLora ? 800 : 250;
|
|
|
|
|
LOG_WARN("Invalid bandwidth %d, setting to default", originalBandwidth);
|
|
|
|
|
}
|
2025-09-28 13:13:07 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
// If no lora radio parameters change, don't need to reboot
|
|
|
|
|
if (oldLoraConfig.use_preset == validatedLora.use_preset && oldLoraConfig.region == validatedLora.region &&
|
|
|
|
|
oldLoraConfig.modem_preset == validatedLora.modem_preset && oldLoraConfig.bandwidth == validatedLora.bandwidth &&
|
|
|
|
|
oldLoraConfig.spread_factor == validatedLora.spread_factor &&
|
|
|
|
|
oldLoraConfig.coding_rate == validatedLora.coding_rate && oldLoraConfig.tx_power == validatedLora.tx_power &&
|
|
|
|
|
oldLoraConfig.frequency_offset == validatedLora.frequency_offset &&
|
|
|
|
|
oldLoraConfig.override_frequency == validatedLora.override_frequency &&
|
|
|
|
|
oldLoraConfig.channel_num == validatedLora.channel_num &&
|
|
|
|
|
oldLoraConfig.sx126x_rx_boosted_gain == validatedLora.sx126x_rx_boosted_gain) {
|
|
|
|
|
requiresReboot = false;
|
|
|
|
|
}
|
2024-07-30 22:05:51 +02:00
|
|
|
|
2025-08-23 05:47:51 -05:00
|
|
|
#if defined(ARCH_PORTDUINO)
|
2026-01-04 12:15:53 +01:00
|
|
|
// If running on portduino and using SimRadio, do not require reboot
|
|
|
|
|
if (SimRadio::instance) {
|
|
|
|
|
requiresReboot = false;
|
|
|
|
|
}
|
2025-08-23 05:47:51 -05:00
|
|
|
#endif
|
|
|
|
|
|
2024-07-30 22:05:51 +02:00
|
|
|
#ifdef RF95_FAN_EN
|
2026-01-04 12:15:53 +01:00
|
|
|
// Turn PA off if disabled by config
|
|
|
|
|
if (c.payload_variant.lora.pa_fan_disabled) {
|
|
|
|
|
digitalWrite(RF95_FAN_EN, LOW ^ 0);
|
|
|
|
|
} else {
|
|
|
|
|
digitalWrite(RF95_FAN_EN, HIGH ^ 0);
|
|
|
|
|
}
|
2024-07-30 22:05:51 +02:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
config.lora = validatedLora;
|
|
|
|
|
// If we're setting region for the first time, init the region and regenerate the keys
|
|
|
|
|
if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
2025-11-20 12:26:07 -08:00
|
|
|
#if !(MESHTASTIC_EXCLUDE_PKI_KEYGEN || MESHTASTIC_EXCLUDE_PKI)
|
2026-01-04 12:15:53 +01:00
|
|
|
if (!owner.is_licensed) {
|
|
|
|
|
bool keygenSuccess = false;
|
|
|
|
|
if (config.security.private_key.size == 32) {
|
|
|
|
|
if (crypto->regeneratePublicKey(config.security.public_key.bytes, config.security.private_key.bytes)) {
|
|
|
|
|
keygenSuccess = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
LOG_INFO("Generate new PKI keys");
|
|
|
|
|
crypto->generateKeyPair(config.security.public_key.bytes, config.security.private_key.bytes);
|
|
|
|
|
keygenSuccess = true;
|
|
|
|
|
}
|
|
|
|
|
if (keygenSuccess) {
|
|
|
|
|
config.security.public_key.size = 32;
|
|
|
|
|
config.security.private_key.size = 32;
|
|
|
|
|
owner.public_key.size = 32;
|
|
|
|
|
memcpy(owner.public_key.bytes, config.security.public_key.bytes, 32);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
config.lora.tx_enabled = true;
|
|
|
|
|
initRegion();
|
|
|
|
|
if (myRegion->dutyCycle < 100) {
|
|
|
|
|
config.lora.ignore_mqtt = true; // Ignore MQTT by default if region has a duty cycle limit
|
|
|
|
|
}
|
|
|
|
|
// Compare the entire string, we are sure of the length as a topic has never been set
|
|
|
|
|
if (strcmp(moduleConfig.mqtt.root, default_mqtt_root) == 0) {
|
|
|
|
|
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
|
|
|
|
|
changes = SEGMENT_CONFIG | SEGMENT_MODULECONFIG;
|
|
|
|
|
}
|
2023-01-18 15:15:02 -06:00
|
|
|
}
|
2026-01-04 12:15:53 +01:00
|
|
|
if (config.lora.region != myRegion->code) {
|
|
|
|
|
// Region has changed so check whether there is a regulatory one we should be using instead.
|
|
|
|
|
// Additionally as a side-effect, assume a new value under myRegion
|
|
|
|
|
initRegion();
|
|
|
|
|
|
|
|
|
|
if (strncmp(moduleConfig.mqtt.root, default_mqtt_root, strlen(default_mqtt_root)) == 0) {
|
|
|
|
|
// Default root is in use, so subscribe to the appropriate MQTT topic for this region
|
|
|
|
|
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changes = SEGMENT_CONFIG | SEGMENT_MODULECONFIG;
|
2025-09-30 16:36:52 +13:00
|
|
|
}
|
2026-01-04 12:15:53 +01:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case meshtastic_Config_bluetooth_tag:
|
|
|
|
|
LOG_INFO("Set config: Bluetooth");
|
|
|
|
|
config.has_bluetooth = true;
|
|
|
|
|
config.bluetooth = c.payload_variant.bluetooth;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_Config_security_tag:
|
|
|
|
|
LOG_INFO("Set config: Security");
|
|
|
|
|
config.security = c.payload_variant.security;
|
2024-08-29 16:28:03 -05:00
|
|
|
#if !(MESHTASTIC_EXCLUDE_PKI_KEYGEN) && !(MESHTASTIC_EXCLUDE_PKI)
|
2026-01-04 12:15:53 +01:00
|
|
|
// If the client set the key to blank, go ahead and regenerate so long as we're not in ham mode
|
|
|
|
|
if (!owner.is_licensed && config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
|
|
|
|
if (config.security.private_key.size != 32) {
|
|
|
|
|
crypto->generateKeyPair(config.security.public_key.bytes, config.security.private_key.bytes);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (crypto->regeneratePublicKey(config.security.public_key.bytes, config.security.private_key.bytes)) {
|
|
|
|
|
config.security.public_key.size = 32;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-29 16:28:03 -05:00
|
|
|
}
|
|
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
owner.public_key.size = config.security.public_key.size;
|
|
|
|
|
memcpy(owner.public_key.bytes, config.security.public_key.bytes, config.security.public_key.size);
|
2024-08-18 15:51:43 -05:00
|
|
|
#if !MESHTASTIC_EXCLUDE_PKI
|
2026-01-04 12:15:53 +01:00
|
|
|
crypto->setDHPrivateKey(config.security.private_key.bytes);
|
2024-08-18 15:51:43 -05:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
if (config.security.is_managed && !(config.security.admin_key[0].size == 32 || config.security.admin_key[1].size == 32 ||
|
|
|
|
|
config.security.admin_key[2].size == 32)) {
|
|
|
|
|
config.security.is_managed = false;
|
|
|
|
|
const char *warning = "You must provide at least one admin public key to enable managed mode";
|
|
|
|
|
LOG_WARN(warning);
|
|
|
|
|
sendWarning(warning);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.security.debug_log_api_enabled == c.payload_variant.security.debug_log_api_enabled &&
|
|
|
|
|
config.security.serial_enabled == c.payload_variant.security.serial_enabled)
|
|
|
|
|
requiresReboot = false;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_Config_device_ui_tag:
|
|
|
|
|
// NOOP! This is handled by handleStoreDeviceUIConfig
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (requiresReboot && !hasOpenEditTransaction) {
|
|
|
|
|
disableBluetooth();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveChanges(changes, requiresReboot);
|
2022-05-02 22:00:24 +10:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
bool AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
|
|
|
|
{
|
|
|
|
|
// If we are in an open transaction or configuring MQTT or Serial (which have validation), defer disabling Bluetooth
|
|
|
|
|
// Otherwise, disable Bluetooth to prevent the phone from interfering with the config
|
|
|
|
|
if (!hasOpenEditTransaction &&
|
|
|
|
|
!IS_ONE_OF(c.which_payload_variant, meshtastic_ModuleConfig_mqtt_tag, meshtastic_ModuleConfig_serial_tag)) {
|
|
|
|
|
disableBluetooth();
|
|
|
|
|
}
|
2025-07-26 05:38:24 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
switch (c.which_payload_variant) {
|
|
|
|
|
case meshtastic_ModuleConfig_mqtt_tag:
|
2025-02-16 05:15:30 -08:00
|
|
|
#if MESHTASTIC_EXCLUDE_MQTT
|
2026-01-04 12:15:53 +01:00
|
|
|
LOG_WARN("Set module config: MESHTASTIC_EXCLUDE_MQTT is defined. Not setting MQTT config");
|
|
|
|
|
return false;
|
2025-02-16 05:15:30 -08:00
|
|
|
#else
|
2026-01-04 12:15:53 +01:00
|
|
|
LOG_INFO("Set module config: MQTT");
|
|
|
|
|
if (!MQTT::isValidConfig(c.payload_variant.mqtt)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Disable Bluetooth to prevent interference during MQTT configuration
|
|
|
|
|
disableBluetooth();
|
|
|
|
|
moduleConfig.has_mqtt = true;
|
|
|
|
|
moduleConfig.mqtt = c.payload_variant.mqtt;
|
2025-02-16 05:15:30 -08:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_serial_tag:
|
|
|
|
|
LOG_INFO("Set module config: Serial");
|
|
|
|
|
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040)) && !defined(CONFIG_IDF_TARGET_ESP32S2) && \
|
|
|
|
|
!defined(CONFIG_IDF_TARGET_ESP32C3)
|
|
|
|
|
if (!SerialModule::isValidConfig(c.payload_variant.serial)) {
|
|
|
|
|
LOG_ERROR("Invalid serial config");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
disableBluetooth(); // Disable Bluetooth to prevent interference during Serial configuration
|
2025-07-26 19:55:54 -05:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
moduleConfig.has_serial = true;
|
|
|
|
|
moduleConfig.serial = c.payload_variant.serial;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_external_notification_tag:
|
|
|
|
|
LOG_INFO("Set module config: External Notification");
|
|
|
|
|
moduleConfig.has_external_notification = true;
|
|
|
|
|
moduleConfig.external_notification = c.payload_variant.external_notification;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_store_forward_tag:
|
|
|
|
|
LOG_INFO("Set module config: Store & Forward");
|
|
|
|
|
moduleConfig.has_store_forward = true;
|
|
|
|
|
moduleConfig.store_forward = c.payload_variant.store_forward;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_range_test_tag:
|
|
|
|
|
LOG_INFO("Set module config: Range Test");
|
|
|
|
|
moduleConfig.has_range_test = true;
|
|
|
|
|
moduleConfig.range_test = c.payload_variant.range_test;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_telemetry_tag:
|
|
|
|
|
LOG_INFO("Set module config: Telemetry");
|
|
|
|
|
moduleConfig.has_telemetry = true;
|
|
|
|
|
moduleConfig.telemetry = c.payload_variant.telemetry;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_canned_message_tag:
|
|
|
|
|
LOG_INFO("Set module config: Canned Message");
|
|
|
|
|
moduleConfig.has_canned_message = true;
|
|
|
|
|
moduleConfig.canned_message = c.payload_variant.canned_message;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_audio_tag:
|
|
|
|
|
LOG_INFO("Set module config: Audio");
|
|
|
|
|
moduleConfig.has_audio = true;
|
|
|
|
|
moduleConfig.audio = c.payload_variant.audio;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_remote_hardware_tag:
|
|
|
|
|
LOG_INFO("Set module config: Remote Hardware");
|
|
|
|
|
moduleConfig.has_remote_hardware = true;
|
|
|
|
|
moduleConfig.remote_hardware = c.payload_variant.remote_hardware;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_neighbor_info_tag:
|
|
|
|
|
LOG_INFO("Set module config: Neighbor Info");
|
|
|
|
|
moduleConfig.has_neighbor_info = true;
|
|
|
|
|
if (moduleConfig.neighbor_info.update_interval < min_neighbor_info_broadcast_secs) {
|
|
|
|
|
LOG_DEBUG("Tried to set update_interval too low, setting to %d", default_neighbor_info_broadcast_secs);
|
|
|
|
|
moduleConfig.neighbor_info.update_interval = default_neighbor_info_broadcast_secs;
|
|
|
|
|
}
|
|
|
|
|
moduleConfig.neighbor_info = c.payload_variant.neighbor_info;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_detection_sensor_tag:
|
|
|
|
|
LOG_INFO("Set module config: Detection Sensor");
|
|
|
|
|
moduleConfig.has_detection_sensor = true;
|
|
|
|
|
moduleConfig.detection_sensor = c.payload_variant.detection_sensor;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_ambient_lighting_tag:
|
|
|
|
|
LOG_INFO("Set module config: Ambient Lighting");
|
|
|
|
|
moduleConfig.has_ambient_lighting = true;
|
|
|
|
|
moduleConfig.ambient_lighting = c.payload_variant.ambient_lighting;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_ModuleConfig_paxcounter_tag:
|
|
|
|
|
LOG_INFO("Set module config: Paxcounter");
|
|
|
|
|
moduleConfig.has_paxcounter = true;
|
|
|
|
|
moduleConfig.paxcounter = c.payload_variant.paxcounter;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
saveChanges(SEGMENT_MODULECONFIG);
|
|
|
|
|
return true;
|
2022-05-02 08:53:44 +10:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleSetChannel(const meshtastic_Channel &cc)
|
|
|
|
|
{
|
|
|
|
|
channels.setChannel(cc);
|
|
|
|
|
if (channels.ensureLicensedOperation()) {
|
|
|
|
|
sendWarning(licensedModeMessage);
|
|
|
|
|
}
|
|
|
|
|
channels.onConfigChanged(); // tell the radios about this change
|
|
|
|
|
saveChanges(SEGMENT_CHANNELS, false);
|
2022-05-02 22:00:24 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-05-03 22:16:50 +10:00
|
|
|
* Getters
|
2022-05-02 22:00:24 +10:00
|
|
|
*/
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleGetOwner(const meshtastic_MeshPacket &req)
|
|
|
|
|
{
|
|
|
|
|
if (req.decoded.want_response) {
|
|
|
|
|
// We create the reply here
|
|
|
|
|
meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default;
|
|
|
|
|
res.get_owner_response = owner;
|
|
|
|
|
|
|
|
|
|
res.which_payload_variant = meshtastic_AdminMessage_get_owner_response_tag;
|
|
|
|
|
setPassKey(&res);
|
|
|
|
|
myReply = allocDataProtobuf(res);
|
|
|
|
|
if (req.pki_encrypted) {
|
|
|
|
|
myReply->pki_encrypted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AdminModule::handleGetConfig(const meshtastic_MeshPacket &req, const uint32_t configType)
|
|
|
|
|
{
|
2023-01-21 18:22:19 +01:00
|
|
|
meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default;
|
2022-05-02 22:00:24 +10:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
if (req.decoded.want_response) {
|
|
|
|
|
switch (configType) {
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: Device");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_device_tag;
|
|
|
|
|
res.get_config_response.payload_variant.device = config.device;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_POSITION_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: Position");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_position_tag;
|
|
|
|
|
res.get_config_response.payload_variant.position = config.position;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_POWER_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: Power");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_power_tag;
|
|
|
|
|
res.get_config_response.payload_variant.power = config.power;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: Network");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_network_tag;
|
|
|
|
|
res.get_config_response.payload_variant.network = config.network;
|
|
|
|
|
writeSecret(res.get_config_response.payload_variant.network.wifi_psk,
|
|
|
|
|
sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk);
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: Display");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_display_tag;
|
|
|
|
|
res.get_config_response.payload_variant.display = config.display;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_LORA_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: LoRa");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_lora_tag;
|
|
|
|
|
res.get_config_response.payload_variant.lora = config.lora;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: Bluetooth");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_bluetooth_tag;
|
|
|
|
|
res.get_config_response.payload_variant.bluetooth = config.bluetooth;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_SECURITY_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: Security");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_security_tag;
|
|
|
|
|
res.get_config_response.payload_variant.security = config.security;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG:
|
|
|
|
|
LOG_INFO("Get config: Sessionkey");
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_sessionkey_tag;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG:
|
|
|
|
|
// NOOP! This is handled by handleGetDeviceUIConfig
|
|
|
|
|
res.get_config_response.which_payload_variant = meshtastic_Config_device_ui_tag;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
|
|
|
|
|
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
|
|
|
|
|
// using to the app (so that even old phone apps work with new device loads).
|
|
|
|
|
// r.get_radio_response.preferences.ls_secs = getPref_ls_secs();
|
|
|
|
|
// hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally
|
|
|
|
|
// private and useful for users to know current provisioning)
|
|
|
|
|
// hideSecret(r.get_radio_response.preferences.wifi_password); r.get_config_response.which_payloadVariant =
|
|
|
|
|
// Config_ModuleConfig_telemetry_tag;
|
|
|
|
|
res.which_payload_variant = meshtastic_AdminMessage_get_config_response_tag;
|
|
|
|
|
setPassKey(&res);
|
|
|
|
|
myReply = allocDataProtobuf(res);
|
|
|
|
|
if (req.pki_encrypted) {
|
|
|
|
|
myReply->pki_encrypted = true;
|
|
|
|
|
}
|
2022-05-02 22:00:24 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const uint32_t configType)
|
|
|
|
|
{
|
|
|
|
|
meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default;
|
|
|
|
|
|
|
|
|
|
if (req.decoded.want_response) {
|
|
|
|
|
switch (configType) {
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: MQTT");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Serial");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_serial_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: External Notification");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Store & Forward");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Range Test");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Telemetry");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Canned Message");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_canned_message_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Audio");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.audio = moduleConfig.audio;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Remote Hardware");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.remote_hardware = moduleConfig.remote_hardware;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_NEIGHBORINFO_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Neighbor Info");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_neighbor_info_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.neighbor_info = moduleConfig.neighbor_info;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Detection Sensor");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_detection_sensor_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.detection_sensor = moduleConfig.detection_sensor;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_AMBIENTLIGHTING_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Ambient Lighting");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_ambient_lighting_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.ambient_lighting = moduleConfig.ambient_lighting;
|
|
|
|
|
break;
|
|
|
|
|
case meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG:
|
|
|
|
|
LOG_INFO("Get module config: Paxcounter");
|
|
|
|
|
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag;
|
|
|
|
|
res.get_module_config_response.payload_variant.paxcounter = moduleConfig.paxcounter;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NOTE: The phone app needs to know the ls_secsvalue so it can properly expect sleep behavior.
|
|
|
|
|
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
|
|
|
|
|
// using to the app (so that even old phone apps work with new device loads).
|
|
|
|
|
// r.get_radio_response.preferences.ls_secs = getPref_ls_secs();
|
|
|
|
|
// hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally
|
|
|
|
|
// private and useful for users to know current provisioning)
|
|
|
|
|
// hideSecret(r.get_radio_response.preferences.wifi_password); r.get_config_response.which_payloadVariant =
|
|
|
|
|
// Config_ModuleConfig_telemetry_tag;
|
|
|
|
|
res.which_payload_variant = meshtastic_AdminMessage_get_module_config_response_tag;
|
|
|
|
|
setPassKey(&res);
|
|
|
|
|
myReply = allocDataProtobuf(res);
|
|
|
|
|
if (req.pki_encrypted) {
|
|
|
|
|
myReply->pki_encrypted = true;
|
|
|
|
|
}
|
2022-05-02 22:00:24 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleGetNodeRemoteHardwarePins(const meshtastic_MeshPacket &req)
|
|
|
|
|
{
|
|
|
|
|
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
|
|
|
|
r.which_payload_variant = meshtastic_AdminMessage_get_node_remote_hardware_pins_response_tag;
|
|
|
|
|
for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) {
|
|
|
|
|
if (devicestate.node_remote_hardware_pins[i].node_num == 0 || !devicestate.node_remote_hardware_pins[i].has_pin) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
r.get_node_remote_hardware_pins_response.node_remote_hardware_pins[i] = devicestate.node_remote_hardware_pins[i];
|
|
|
|
|
}
|
|
|
|
|
for (uint8_t i = 0; i < moduleConfig.remote_hardware.available_pins_count; i++) {
|
|
|
|
|
if (!moduleConfig.remote_hardware.available_pins[i].gpio_pin) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
meshtastic_NodeRemoteHardwarePin nodePin = meshtastic_NodeRemoteHardwarePin_init_default;
|
|
|
|
|
nodePin.node_num = nodeDB->getNodeNum();
|
|
|
|
|
nodePin.pin = moduleConfig.remote_hardware.available_pins[i];
|
|
|
|
|
r.get_node_remote_hardware_pins_response.node_remote_hardware_pins[i + 12] = nodePin;
|
|
|
|
|
}
|
|
|
|
|
setPassKey(&r);
|
|
|
|
|
myReply = allocDataProtobuf(r);
|
2025-08-24 10:13:18 -05:00
|
|
|
if (req.pki_encrypted) {
|
2026-01-04 12:15:53 +01:00
|
|
|
myReply->pki_encrypted = true;
|
2025-08-24 10:13:18 -05:00
|
|
|
}
|
2022-08-08 07:19:04 -05:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req)
|
|
|
|
|
{
|
|
|
|
|
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
|
|
|
|
r.get_device_metadata_response = getDeviceMetadata();
|
|
|
|
|
r.which_payload_variant = meshtastic_AdminMessage_get_device_metadata_response_tag;
|
|
|
|
|
setPassKey(&r);
|
|
|
|
|
myReply = allocDataProtobuf(r);
|
|
|
|
|
if (req.pki_encrypted) {
|
|
|
|
|
myReply->pki_encrypted = true;
|
|
|
|
|
}
|
2026-01-03 21:19:24 +01:00
|
|
|
}
|
2023-02-02 14:05:58 -06:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req)
|
|
|
|
|
{
|
|
|
|
|
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
2026-01-03 21:19:24 +01:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
meshtastic_DeviceConnectionStatus conn = meshtastic_DeviceConnectionStatus_init_zero;
|
2023-02-02 14:05:58 -06:00
|
|
|
|
|
|
|
|
#if HAS_WIFI
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.has_wifi = true;
|
|
|
|
|
conn.wifi.has_status = true;
|
2023-02-03 11:00:05 -06:00
|
|
|
#ifdef ARCH_PORTDUINO
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.wifi.status.is_connected = true;
|
2023-02-03 11:11:09 -06:00
|
|
|
#else
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.wifi.status.is_connected = WiFi.status() == WL_CONNECTED;
|
2023-02-03 11:00:05 -06:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
strncpy(conn.wifi.ssid, config.network.wifi_ssid, 33);
|
|
|
|
|
if (conn.wifi.status.is_connected) {
|
|
|
|
|
conn.wifi.rssi = WiFi.RSSI();
|
|
|
|
|
conn.wifi.status.ip_address = WiFi.localIP();
|
2024-06-06 22:31:10 +09:30
|
|
|
#ifndef MESHTASTIC_EXCLUDE_MQTT
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.wifi.status.is_mqtt_connected = mqtt && mqtt->isConnectedDirectly();
|
2024-06-06 22:31:10 +09:30
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.wifi.status.is_syslog_connected = false; // FIXME wire this up
|
|
|
|
|
}
|
2023-02-02 14:05:58 -06:00
|
|
|
#endif
|
|
|
|
|
|
2025-03-15 14:15:35 +01:00
|
|
|
#if HAS_ETHERNET && !defined(USE_WS5500)
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.has_ethernet = true;
|
|
|
|
|
conn.ethernet.has_status = true;
|
|
|
|
|
if (Ethernet.linkStatus() == LinkON) {
|
|
|
|
|
conn.ethernet.status.is_connected = true;
|
|
|
|
|
conn.ethernet.status.ip_address = Ethernet.localIP();
|
2024-03-25 05:33:57 -06:00
|
|
|
#if !MESHTASTIC_EXCLUDE_MQTT
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.ethernet.status.is_mqtt_connected = mqtt && mqtt->isConnectedDirectly();
|
2024-03-25 05:33:57 -06:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.ethernet.status.is_syslog_connected = false; // FIXME wire this up
|
|
|
|
|
} else {
|
|
|
|
|
conn.ethernet.status.is_connected = false;
|
|
|
|
|
}
|
2023-02-02 14:40:18 -06:00
|
|
|
#endif
|
|
|
|
|
|
2023-02-02 14:05:58 -06:00
|
|
|
#if HAS_BLUETOOTH
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.has_bluetooth = true;
|
|
|
|
|
conn.bluetooth.pin = config.bluetooth.fixed_pin;
|
2023-02-03 08:50:10 -06:00
|
|
|
#ifdef ARCH_ESP32
|
2026-01-04 12:15:53 +01:00
|
|
|
if (config.bluetooth.enabled && nimbleBluetooth) {
|
|
|
|
|
conn.bluetooth.is_connected = nimbleBluetooth->isConnected();
|
|
|
|
|
conn.bluetooth.rssi = nimbleBluetooth->getRssi();
|
|
|
|
|
}
|
2023-02-03 08:50:10 -06:00
|
|
|
#elif defined(ARCH_NRF52)
|
2026-01-04 12:15:53 +01:00
|
|
|
if (config.bluetooth.enabled && nrf52Bluetooth) {
|
|
|
|
|
conn.bluetooth.is_connected = nrf52Bluetooth->isConnected();
|
|
|
|
|
}
|
2023-12-14 13:40:22 +01:00
|
|
|
#endif
|
2023-02-02 14:05:58 -06:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.has_serial = true; // No serial-less devices
|
2025-06-22 18:48:16 -05:00
|
|
|
#if !MESHTASTIC_EXCLUDE_POWER_FSM
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.serial.is_connected = powerFSM.getState() == &stateSERIAL;
|
2024-08-06 18:48:55 -05:00
|
|
|
#else
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.serial.is_connected = powerFSM.getState();
|
2024-08-10 13:45:41 -05:00
|
|
|
#endif
|
2026-01-04 12:15:53 +01:00
|
|
|
conn.serial.baud = SERIAL_BAUD;
|
2023-02-02 14:05:58 -06:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
r.get_device_connection_status_response = conn;
|
|
|
|
|
r.which_payload_variant = meshtastic_AdminMessage_get_device_connection_status_response_tag;
|
2026-01-03 21:19:24 +01:00
|
|
|
setPassKey(&r);
|
2024-12-27 10:46:21 +11:00
|
|
|
myReply = allocDataProtobuf(r);
|
2025-08-24 10:13:18 -05:00
|
|
|
if (req.pki_encrypted) {
|
2026-01-04 12:15:53 +01:00
|
|
|
myReply->pki_encrypted = true;
|
2025-08-24 10:13:18 -05:00
|
|
|
}
|
2024-12-27 10:46:21 +11:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex)
|
|
|
|
|
{
|
|
|
|
|
if (req.decoded.want_response) {
|
|
|
|
|
// We create the reply here
|
|
|
|
|
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
|
|
|
|
r.get_channel_response = channels.getByIndex(channelIndex);
|
|
|
|
|
r.which_payload_variant = meshtastic_AdminMessage_get_channel_response_tag;
|
|
|
|
|
setPassKey(&r);
|
|
|
|
|
myReply = allocDataProtobuf(r);
|
|
|
|
|
if (req.pki_encrypted) {
|
|
|
|
|
myReply->pki_encrypted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-19 19:19:04 -05:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleGetDeviceUIConfig(const meshtastic_MeshPacket &req)
|
|
|
|
|
{
|
|
|
|
|
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
|
|
|
|
r.which_payload_variant = meshtastic_AdminMessage_get_ui_config_response_tag;
|
|
|
|
|
r.get_ui_config_response = uiconfig;
|
|
|
|
|
myReply = allocDataProtobuf(r);
|
|
|
|
|
if (req.pki_encrypted) {
|
|
|
|
|
myReply->pki_encrypted = true;
|
|
|
|
|
}
|
2022-11-20 19:50:45 -06:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::reboot(int32_t seconds)
|
|
|
|
|
{
|
|
|
|
|
LOG_INFO("Reboot in %d seconds", seconds);
|
|
|
|
|
if (screen)
|
|
|
|
|
screen->showSimpleBanner("Rebooting...", 0); // stays on screen
|
|
|
|
|
rebootAtMsec = (seconds < 0) ? 0 : (millis() + seconds * 1000);
|
2024-12-27 10:46:21 +11:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
|
|
|
|
|
{
|
|
|
|
|
if (!hasOpenEditTransaction) {
|
|
|
|
|
LOG_INFO("Save changes to disk");
|
|
|
|
|
service->reloadConfig(saveWhat); // Calls saveToDisk among other things
|
|
|
|
|
} else {
|
|
|
|
|
LOG_INFO("Delay save of changes to disk until the open transaction is committed");
|
|
|
|
|
}
|
|
|
|
|
if (shouldReboot && !hasOpenEditTransaction) {
|
|
|
|
|
reboot(DEFAULT_REBOOT_SECONDS);
|
|
|
|
|
}
|
2026-01-03 21:19:24 +01:00
|
|
|
}
|
2023-02-08 15:29:33 -06:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleStoreDeviceUIConfig(const meshtastic_DeviceUIConfig &uicfg)
|
|
|
|
|
{
|
|
|
|
|
nodeDB->saveProto("/prefs/uiconfig.proto", meshtastic_DeviceUIConfig_size, &meshtastic_DeviceUIConfig_msg, &uicfg);
|
2023-02-04 15:11:36 -06:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleSetHamMode(const meshtastic_HamParameters &p)
|
|
|
|
|
{
|
|
|
|
|
// Validate ham parameters before setting since this would bypass validation in the owner struct
|
|
|
|
|
if (*p.call_sign) {
|
|
|
|
|
const char *start = p.call_sign;
|
|
|
|
|
// Skip all whitespace
|
|
|
|
|
while (*start && isspace((unsigned char)*start))
|
|
|
|
|
start++;
|
|
|
|
|
if (*start == '\0') {
|
|
|
|
|
LOG_WARN("Rejected ham call_sign: must contain at least 1 non-whitespace character");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (*p.short_name) {
|
|
|
|
|
const char *start = p.short_name;
|
|
|
|
|
while (*start && isspace((unsigned char)*start))
|
|
|
|
|
start++;
|
|
|
|
|
if (*start == '\0') {
|
|
|
|
|
LOG_WARN("Rejected ham short_name: must contain at least 1 non-whitespace character");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set call sign and override lora limitations for licensed use
|
|
|
|
|
strncpy(owner.long_name, p.call_sign, sizeof(owner.long_name));
|
|
|
|
|
strncpy(owner.short_name, p.short_name, sizeof(owner.short_name));
|
|
|
|
|
owner.is_licensed = true;
|
|
|
|
|
config.lora.override_duty_cycle = true;
|
|
|
|
|
config.lora.tx_power = p.tx_power;
|
|
|
|
|
config.lora.override_frequency = p.frequency;
|
|
|
|
|
// Set node info broadcast interval to 10 minutes
|
|
|
|
|
// For FCC minimum call-sign announcement
|
|
|
|
|
config.device.node_info_broadcast_secs = 600;
|
|
|
|
|
|
|
|
|
|
config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY;
|
|
|
|
|
// Remove PSK of primary channel for plaintext amateur usage
|
|
|
|
|
|
|
|
|
|
if (channels.ensureLicensedOperation()) {
|
|
|
|
|
sendWarning(licensedModeMessage);
|
|
|
|
|
}
|
|
|
|
|
channels.onConfigChanged();
|
|
|
|
|
|
|
|
|
|
service->reloadOwner(false);
|
|
|
|
|
saveChanges(SEGMENT_CONFIG | SEGMENT_NODEDATABASE | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AdminModule::AdminModule() : ProtobufModule("Admin", meshtastic_PortNum_ADMIN_APP, &meshtastic_AdminMessage_msg)
|
|
|
|
|
{
|
|
|
|
|
// restrict to the admin channel for rx
|
|
|
|
|
// boundChannel = Channels::adminChannel;
|
2024-08-17 08:41:12 -05:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::setPassKey(meshtastic_AdminMessage *res)
|
|
|
|
|
{
|
|
|
|
|
if (session_time == 0 || millis() / 1000 > session_time + 150) {
|
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
|
|
|
session_passkey[i] = random();
|
|
|
|
|
}
|
|
|
|
|
session_time = millis() / 1000;
|
|
|
|
|
}
|
|
|
|
|
memcpy(res->session_passkey.bytes, session_passkey, 8);
|
|
|
|
|
res->session_passkey.size = 8;
|
|
|
|
|
printBytes("Set admin key to ", res->session_passkey.bytes, 8);
|
|
|
|
|
// if halfway to session_expire, regenerate session_passkey, reset the timeout
|
|
|
|
|
// set the key in the packet
|
2024-08-17 08:41:12 -05:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
bool AdminModule::checkPassKey(meshtastic_AdminMessage *res)
|
|
|
|
|
{ // check that the key in the packet is still valid
|
|
|
|
|
printBytes("Incoming session key: ", res->session_passkey.bytes, 8);
|
|
|
|
|
printBytes("Expected session key: ", session_passkey, 8);
|
|
|
|
|
return (session_time + 300 > millis() / 1000 && res->session_passkey.size == 8 &&
|
|
|
|
|
memcmp(res->session_passkey.bytes, session_passkey, 8) == 0);
|
2024-08-17 08:41:12 -05:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
bool AdminModule::messageIsResponse(const meshtastic_AdminMessage *r)
|
|
|
|
|
{
|
|
|
|
|
if (r->which_payload_variant == meshtastic_AdminMessage_get_channel_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_owner_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_config_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_module_config_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_canned_message_module_messages_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_device_metadata_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_ringtone_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_device_connection_status_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_node_remote_hardware_pins_response_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_ui_config_response_tag)
|
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
2024-08-17 08:41:12 -05:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
bool AdminModule::messageIsRequest(const meshtastic_AdminMessage *r)
|
|
|
|
|
{
|
|
|
|
|
if (r->which_payload_variant == meshtastic_AdminMessage_get_channel_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_owner_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_config_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_module_config_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_canned_message_module_messages_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_device_metadata_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_ringtone_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_device_connection_status_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_node_remote_hardware_pins_request_tag ||
|
|
|
|
|
r->which_payload_variant == meshtastic_AdminMessage_get_ui_config_request_tag)
|
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
2024-08-30 06:02:48 -05:00
|
|
|
}
|
2024-09-11 08:42:26 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::handleSendInputEvent(const meshtastic_AdminMessage_InputEvent &inputEvent)
|
|
|
|
|
{
|
|
|
|
|
LOG_DEBUG("Processing input event: event_code=%u, kb_char=%u, touch_x=%u, touch_y=%u", inputEvent.event_code,
|
|
|
|
|
inputEvent.kb_char, inputEvent.touch_x, inputEvent.touch_y);
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
// Create InputEvent for injection
|
|
|
|
|
InputEvent event = {.inputEvent = (input_broker_event)inputEvent.event_code,
|
|
|
|
|
.kbchar = (unsigned char)inputEvent.kb_char,
|
|
|
|
|
.touchX = inputEvent.touch_x,
|
|
|
|
|
.touchY = inputEvent.touch_y};
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
// Log the event being injected
|
|
|
|
|
LOG_INFO("Injecting input event from admin: source=%s, event=%u, char=%c(%u), touch=(%u,%u)", event.source, event.inputEvent,
|
|
|
|
|
(event.kbchar >= 32 && event.kbchar <= 126) ? event.kbchar : '?', event.kbchar, event.touchX, event.touchY);
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
// Wake the device if asleep
|
|
|
|
|
powerFSM.trigger(EVENT_INPUT);
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
#if !defined(MESHTASTIC_EXCLUDE_INPUTBROKER)
|
2026-01-04 12:15:53 +01:00
|
|
|
// Inject the event through InputBroker
|
|
|
|
|
if (inputBroker) {
|
|
|
|
|
inputBroker->injectInputEvent(&event);
|
|
|
|
|
} else {
|
|
|
|
|
LOG_ERROR("InputBroker not available for event injection");
|
|
|
|
|
}
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void AdminModule::sendWarning(const char *message)
|
|
|
|
|
{
|
|
|
|
|
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
|
|
|
|
|
cn->level = meshtastic_LogRecord_Level_WARNING;
|
|
|
|
|
cn->time = getValidTime(RTCQualityFromNet);
|
|
|
|
|
strncpy(cn->message, message, sizeof(cn->message));
|
|
|
|
|
service->sendClientNotification(cn);
|
2024-10-12 06:17:44 -05:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 12:15:53 +01:00
|
|
|
void disableBluetooth()
|
|
|
|
|
{
|
2024-09-11 08:42:26 -05:00
|
|
|
#if HAS_BLUETOOTH
|
|
|
|
|
#ifdef ARCH_ESP32
|
2026-01-04 12:15:53 +01:00
|
|
|
if (nimbleBluetooth)
|
|
|
|
|
nimbleBluetooth->deinit();
|
2024-09-11 08:42:26 -05:00
|
|
|
#elif defined(ARCH_NRF52)
|
2026-01-04 12:15:53 +01:00
|
|
|
if (nrf52Bluetooth)
|
|
|
|
|
nrf52Bluetooth->shutdown();
|
2024-09-11 08:42:26 -05:00
|
|
|
#endif
|
|
|
|
|
#endif
|
2025-02-23 20:14:37 +08:00
|
|
|
}
|