mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-17 08:12:32 +00:00
Compare commits
14 Commits
feat-184
...
static-buf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b77cafbab7 | ||
|
|
803e96800e | ||
|
|
6c69780615 | ||
|
|
d5bb566276 | ||
|
|
39ff880506 | ||
|
|
209157c9dd | ||
|
|
fb59d68edd | ||
|
|
7b854fb5ca | ||
|
|
f8b160595f | ||
|
|
4ed7043aea | ||
|
|
7a48bd5e76 | ||
|
|
a5bb0ee284 | ||
|
|
54d64e19f7 | ||
|
|
d095b6b92e |
@@ -7,6 +7,7 @@ SET "DEBUG=0"
|
|||||||
SET "PYTHON="
|
SET "PYTHON="
|
||||||
SET "TFT_BUILD=0"
|
SET "TFT_BUILD=0"
|
||||||
SET "BIGDB8=0"
|
SET "BIGDB8=0"
|
||||||
|
SET "MUIDB8=0"
|
||||||
SET "BIGDB16=0"
|
SET "BIGDB16=0"
|
||||||
SET "ESPTOOL_BAUD=115200"
|
SET "ESPTOOL_BAUD=115200"
|
||||||
SET "ESPTOOL_CMD="
|
SET "ESPTOOL_CMD="
|
||||||
@@ -17,7 +18,8 @@ SET "BPS_RESET=0"
|
|||||||
SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone t-eth-elite tlora-pager mesh-tab dreamcatcher ESP32-S3-Pico seeed-sensecap-indicator heltec_capsule_sensor_v3 vision-master icarus tracksenger elecrow-adv"
|
SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone t-eth-elite tlora-pager mesh-tab dreamcatcher ESP32-S3-Pico seeed-sensecap-indicator heltec_capsule_sensor_v3 vision-master icarus tracksenger elecrow-adv"
|
||||||
SET "C3=esp32c3"
|
SET "C3=esp32c3"
|
||||||
@REM FIXME: Determine flash size from PlatformIO variant, this is unmaintainable.
|
@REM FIXME: Determine flash size from PlatformIO variant, this is unmaintainable.
|
||||||
SET "BIGDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core tracksenger"
|
SET "BIGDB_8MB=crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core tracksenger"
|
||||||
|
SET "MUIDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator"
|
||||||
SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite tlora-pager t-watch-s3 elecrow-adv"
|
SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite tlora-pager t-watch-s3 elecrow-adv"
|
||||||
|
|
||||||
GOTO getopts
|
GOTO getopts
|
||||||
@@ -162,6 +164,15 @@ FOR %%a IN (%BIGDB_8MB%) DO (
|
|||||||
)
|
)
|
||||||
:end_loop_bigdb_8mb
|
:end_loop_bigdb_8mb
|
||||||
|
|
||||||
|
FOR %%a IN (%MUIDB_8MB%) DO (
|
||||||
|
IF NOT "!FILENAME:%%a=!"=="!FILENAME!" (
|
||||||
|
@REM We are working with any of %MUIDB_8MB%.
|
||||||
|
SET "MUIDB8=1"
|
||||||
|
GOTO end_loop_muidb_8mb
|
||||||
|
)
|
||||||
|
)
|
||||||
|
:end_loop_muidb_8mb
|
||||||
|
|
||||||
FOR %%a IN (%BIGDB_16MB%) DO (
|
FOR %%a IN (%BIGDB_16MB%) DO (
|
||||||
IF NOT "!FILENAME:%%a=!"=="!FILENAME!" (
|
IF NOT "!FILENAME:%%a=!"=="!FILENAME!" (
|
||||||
@REM We are working with any of %BIGDB_16MB%.
|
@REM We are working with any of %BIGDB_16MB%.
|
||||||
@@ -172,6 +183,7 @@ FOR %%a IN (%BIGDB_16MB%) DO (
|
|||||||
:end_loop_bigdb_16mb
|
:end_loop_bigdb_16mb
|
||||||
|
|
||||||
IF %BIGDB8% EQU 1 CALL :LOG_MESSAGE INFO "BigDB 8mb partition selected."
|
IF %BIGDB8% EQU 1 CALL :LOG_MESSAGE INFO "BigDB 8mb partition selected."
|
||||||
|
IF %MUIDB8% EQU 1 CALL :LOG_MESSAGE INFO "MUIDB 8mb partition selected."
|
||||||
IF %BIGDB16% EQU 1 CALL :LOG_MESSAGE INFO "BigDB 16mb partition selected."
|
IF %BIGDB16% EQU 1 CALL :LOG_MESSAGE INFO "BigDB 16mb partition selected."
|
||||||
|
|
||||||
@REM Extract BASENAME from %FILENAME% for later use.
|
@REM Extract BASENAME from %FILENAME% for later use.
|
||||||
@@ -216,6 +228,12 @@ IF %BIGDB8% EQU 1 (
|
|||||||
SET "SPIFFS_OFFSET=0x670000"
|
SET "SPIFFS_OFFSET=0x670000"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@REM Offsets for MUIDB 8mb.
|
||||||
|
IF %MUIDB8% EQU 1 (
|
||||||
|
SET "OTA_OFFSET=0x5D0000"
|
||||||
|
SET "SPIFFS_OFFSET=0x670000"
|
||||||
|
)
|
||||||
|
|
||||||
@REM Offsets for BigDB 16mb.
|
@REM Offsets for BigDB 16mb.
|
||||||
IF %BIGDB16% EQU 1 (
|
IF %BIGDB16% EQU 1 (
|
||||||
SET "OTA_OFFSET=0x650000"
|
SET "OTA_OFFSET=0x650000"
|
||||||
@@ -232,14 +250,14 @@ IF NOT EXIST !SPIFFS_FILENAME! CALL :LOG_MESSAGE ERROR "File does not exist: "!S
|
|||||||
|
|
||||||
@REM Flashing operations.
|
@REM Flashing operations.
|
||||||
CALL :LOG_MESSAGE INFO "Trying to flash "!FILENAME!", but first erasing and writing system information..."
|
CALL :LOG_MESSAGE INFO "Trying to flash "!FILENAME!", but first erasing and writing system information..."
|
||||||
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! erase-flash || GOTO eof
|
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! erase_flash || GOTO eof
|
||||||
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write-flash 0x00 "!FILENAME!" || GOTO eof
|
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash 0x00 "!FILENAME!" || GOTO eof
|
||||||
|
|
||||||
CALL :LOG_MESSAGE INFO "Trying to flash BLEOTA "!OTA_FILENAME!" at OTA_OFFSET !OTA_OFFSET!..."
|
CALL :LOG_MESSAGE INFO "Trying to flash BLEOTA "!OTA_FILENAME!" at OTA_OFFSET !OTA_OFFSET!..."
|
||||||
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write-flash !OTA_OFFSET! "!OTA_FILENAME!" || GOTO eof
|
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash !OTA_OFFSET! "!OTA_FILENAME!" || GOTO eof
|
||||||
|
|
||||||
CALL :LOG_MESSAGE INFO "Trying to flash SPIFFS "!SPIFFS_FILENAME!" at SPIFFS_OFFSET !SPIFFS_OFFSET!..."
|
CALL :LOG_MESSAGE INFO "Trying to flash SPIFFS "!SPIFFS_FILENAME!" at SPIFFS_OFFSET !SPIFFS_OFFSET!..."
|
||||||
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write-flash !SPIFFS_OFFSET! "!SPIFFS_FILENAME!" || GOTO eof
|
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash !SPIFFS_OFFSET! "!SPIFFS_FILENAME!" || GOTO eof
|
||||||
|
|
||||||
CALL :LOG_MESSAGE INFO "Script complete!."
|
CALL :LOG_MESSAGE INFO "Script complete!."
|
||||||
|
|
||||||
@@ -251,9 +269,9 @@ EXIT /B %ERRORLEVEL%
|
|||||||
:RUN_ESPTOOL
|
:RUN_ESPTOOL
|
||||||
@REM Subroutine used to run ESPTOOL_CMD with arguments.
|
@REM Subroutine used to run ESPTOOL_CMD with arguments.
|
||||||
@REM Also handles %ERRORLEVEL%.
|
@REM Also handles %ERRORLEVEL%.
|
||||||
@REM CALL :RUN_ESPTOOL [Baud] [erase_flash|write-flash] [OFFSET] [Filename]
|
@REM CALL :RUN_ESPTOOL [Baud] [erase_flash|write_flash] [OFFSET] [Filename]
|
||||||
@REM.
|
@REM.
|
||||||
@REM Example:: CALL :RUN_ESPTOOL 115200 write-flash 0x10000 "firmwarefile.bin"
|
@REM Example:: CALL :RUN_ESPTOOL 115200 write_flash 0x10000 "firmwarefile.bin"
|
||||||
IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
||||||
CALL :RESET_ERROR
|
CALL :RESET_ERROR
|
||||||
!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4
|
!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ FIRMWARE_OFFSET=0x00
|
|||||||
|
|
||||||
# Variant groups
|
# Variant groups
|
||||||
BIGDB_8MB=(
|
BIGDB_8MB=(
|
||||||
"picomputer-s3"
|
|
||||||
"unphone"
|
|
||||||
"seeed-sensecap-indicator"
|
|
||||||
"crowpanel-esp32s3"
|
"crowpanel-esp32s3"
|
||||||
"heltec_capsule_sensor_v3"
|
"heltec_capsule_sensor_v3"
|
||||||
"heltec-v3"
|
"heltec-v3"
|
||||||
@@ -28,6 +25,11 @@ BIGDB_8MB=(
|
|||||||
"tbeam-s3-core"
|
"tbeam-s3-core"
|
||||||
"tracksenger"
|
"tracksenger"
|
||||||
)
|
)
|
||||||
|
MUIDB_8MB=(
|
||||||
|
"picomputer-s3"
|
||||||
|
"unphone"
|
||||||
|
"seeed-sensecap-indicator"
|
||||||
|
)
|
||||||
BIGDB_16MB=(
|
BIGDB_16MB=(
|
||||||
"t-deck"
|
"t-deck"
|
||||||
"mesh-tab"
|
"mesh-tab"
|
||||||
@@ -162,6 +164,13 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for variant in "${MUIDB_8MB[@]}"; do
|
||||||
|
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
||||||
|
OFFSET=0x670000
|
||||||
|
OTA_OFFSET=0x5D0000
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# littlefs* offset for BigDB 16mb and OTA OFFSET.
|
# littlefs* offset for BigDB 16mb and OTA OFFSET.
|
||||||
for variant in "${BIGDB_16MB[@]}"; do
|
for variant in "${BIGDB_16MB[@]}"; do
|
||||||
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
||||||
@@ -208,9 +217,9 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
|
|||||||
$ESPTOOL_CMD erase-flash
|
$ESPTOOL_CMD erase-flash
|
||||||
$ESPTOOL_CMD write-flash $FIRMWARE_OFFSET "${FILENAME}"
|
$ESPTOOL_CMD write-flash $FIRMWARE_OFFSET "${FILENAME}"
|
||||||
echo "Trying to flash ${OTAFILE} at offset ${OTA_OFFSET}"
|
echo "Trying to flash ${OTAFILE} at offset ${OTA_OFFSET}"
|
||||||
$ESPTOOL_CMD write-flash $OTA_OFFSET "${OTAFILE}"
|
$ESPTOOL_CMD write_flash $OTA_OFFSET "${OTAFILE}"
|
||||||
echo "Trying to flash ${SPIFFSFILE}, at offset ${OFFSET}"
|
echo "Trying to flash ${SPIFFSFILE}, at offset ${OFFSET}"
|
||||||
$ESPTOOL_CMD write-flash $OFFSET "${SPIFFSFILE}"
|
$ESPTOOL_CMD write_flash $OFFSET "${SPIFFSFILE}"
|
||||||
|
|
||||||
else
|
else
|
||||||
show_help
|
show_help
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"arduino": {
|
"arduino": {
|
||||||
"ldscript": "esp32s3_out.ld",
|
"ldscript": "esp32s3_out.ld",
|
||||||
"partitions": "default_8MB.csv",
|
"partitions": "partition-table-8MB.csv",
|
||||||
"memory_type": "qio_opi"
|
"memory_type": "qio_opi"
|
||||||
},
|
},
|
||||||
"core": "esp32",
|
"core": "esp32",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"arduino": {
|
"arduino": {
|
||||||
"ldscript": "esp32s3_out.ld",
|
"ldscript": "esp32s3_out.ld",
|
||||||
"memory_type": "qio_opi",
|
"memory_type": "qio_opi",
|
||||||
"partitions": "default_8MB.csv"
|
"partitions": "partition-table-8MB.csv"
|
||||||
},
|
},
|
||||||
"core": "esp32",
|
"core": "esp32",
|
||||||
"extra_flags": [
|
"extra_flags": [
|
||||||
|
|||||||
7
partition-table-8MB.csv
Normal file
7
partition-table-8MB.csv
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# This is a layout for 8MB of flash for MUI devices
|
||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
nvs, data, nvs, 0x9000, 0x5000,
|
||||||
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
|
app0, app, ota_0, 0x10000, 0x5C0000,
|
||||||
|
flashApp, app, ota_1, 0x5D0000,0x0A0000,
|
||||||
|
spiffs, data, spiffs, 0x670000,0x180000
|
||||||
|
@@ -118,7 +118,7 @@ lib_deps =
|
|||||||
[device-ui_base]
|
[device-ui_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
||||||
https://github.com/meshtastic/device-ui/archive/a04bc94b45dacdabf3ae1832d4591390e35fc61f.zip
|
https://github.com/meshtastic/device-ui/archive/3677476c8a823ee85056b5fb1d146a3e193f8276.zip
|
||||||
|
|
||||||
; Common libs for environmental measurements in telemetry module
|
; Common libs for environmental measurements in telemetry module
|
||||||
[environmental_base]
|
[environmental_base]
|
||||||
|
|||||||
Submodule protobufs updated: 07d6573e10...a84657c220
@@ -1,5 +1,4 @@
|
|||||||
#include <cstring> // Include for strstr
|
#include <cstring> // Include for strstr
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
@@ -1370,34 +1369,42 @@ GnssModel_t GPS::probe(int serialSpeed)
|
|||||||
|
|
||||||
GnssModel_t GPS::getProbeResponse(unsigned long timeout, const std::vector<ChipInfo> &responseMap)
|
GnssModel_t GPS::getProbeResponse(unsigned long timeout, const std::vector<ChipInfo> &responseMap)
|
||||||
{
|
{
|
||||||
String response = "";
|
char response[256] = {0}; // Fixed buffer instead of String
|
||||||
|
uint16_t responseLen = 0;
|
||||||
unsigned long start = millis();
|
unsigned long start = millis();
|
||||||
while (millis() - start < timeout) {
|
while (millis() - start < timeout) {
|
||||||
if (_serial_gps->available()) {
|
if (_serial_gps->available()) {
|
||||||
response += (char)_serial_gps->read();
|
char c = _serial_gps->read();
|
||||||
|
|
||||||
if (response.endsWith(",") || response.endsWith("\r\n")) {
|
// Add char to buffer if there's space
|
||||||
|
if (responseLen < sizeof(response) - 1) {
|
||||||
|
response[responseLen++] = c;
|
||||||
|
response[responseLen] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c == ',' || (responseLen >= 2 && response[responseLen - 2] == '\r' && response[responseLen - 1] == '\n')) {
|
||||||
#ifdef GPS_DEBUG
|
#ifdef GPS_DEBUG
|
||||||
LOG_DEBUG(response.c_str());
|
LOG_DEBUG(response);
|
||||||
#endif
|
#endif
|
||||||
// check if we can see our chips
|
// check if we can see our chips
|
||||||
for (const auto &chipInfo : responseMap) {
|
for (const auto &chipInfo : responseMap) {
|
||||||
if (strstr(response.c_str(), chipInfo.detectionString.c_str()) != nullptr) {
|
if (strstr(response, chipInfo.detectionString.c_str()) != nullptr) {
|
||||||
LOG_INFO("%s detected", chipInfo.chipName.c_str());
|
LOG_INFO("%s detected", chipInfo.chipName.c_str());
|
||||||
return chipInfo.driver;
|
return chipInfo.driver;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (response.endsWith("\r\n")) {
|
if (responseLen >= 2 && response[responseLen - 2] == '\r' && response[responseLen - 1] == '\n') {
|
||||||
response.trim();
|
// Reset the response buffer for the next potential message
|
||||||
response = ""; // Reset the response string for the next potential message
|
responseLen = 0;
|
||||||
|
response[0] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef GPS_DEBUG
|
#ifdef GPS_DEBUG
|
||||||
LOG_DEBUG(response.c_str());
|
LOG_DEBUG(response);
|
||||||
#endif
|
#endif
|
||||||
return GNSS_MODEL_UNKNOWN; // Return empty string on timeout
|
return GNSS_MODEL_UNKNOWN; // Return unknown on timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
GPS *GPS::createGps()
|
GPS *GPS::createGps()
|
||||||
@@ -1532,10 +1539,9 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
|
|||||||
t.tm_year = d.year() - 1900;
|
t.tm_year = d.year() - 1900;
|
||||||
t.tm_isdst = false;
|
t.tm_isdst = false;
|
||||||
if (t.tm_mon > -1) {
|
if (t.tm_mon > -1) {
|
||||||
LOG_DEBUG("NMEA GPS time %02d-%02d-%02d %02d:%02d:%02d age %d", d.year(), d.month(), t.tm_mday, t.tm_hour, t.tm_min,
|
|
||||||
t.tm_sec, ti.age());
|
|
||||||
if (perhapsSetRTC(RTCQualityGPS, t) == RTCSetResultSuccess) {
|
if (perhapsSetRTC(RTCQualityGPS, t) == RTCSetResultSuccess) {
|
||||||
LOG_DEBUG("Time set.");
|
LOG_DEBUG("NMEA GPS time set %02d-%02d-%02d %02d:%02d:%02d age %d", d.year(), d.month(), t.tm_mday, t.tm_hour,
|
||||||
|
t.tm_min, t.tm_sec, ti.age());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -40,10 +40,7 @@ bool RotaryEncoderImpl::init()
|
|||||||
|
|
||||||
int32_t RotaryEncoderImpl::runOnce()
|
int32_t RotaryEncoderImpl::runOnce()
|
||||||
{
|
{
|
||||||
InputEvent e;
|
InputEvent e{originName, INPUT_BROKER_NONE, 0, 0, 0};
|
||||||
e.inputEvent = INPUT_BROKER_NONE;
|
|
||||||
e.source = this->originName;
|
|
||||||
|
|
||||||
static uint32_t lastPressed = millis();
|
static uint32_t lastPressed = millis();
|
||||||
if (rotary->readButton() == RotaryEncoder::ButtonState::BUTTON_PRESSED) {
|
if (rotary->readButton() == RotaryEncoder::ButtonState::BUTTON_PRESSED) {
|
||||||
if (lastPressed + 200 < millis()) {
|
if (lastPressed + 200 < millis()) {
|
||||||
|
|||||||
@@ -64,7 +64,12 @@ typedef enum _meshtastic_Config_DeviceConfig_Role {
|
|||||||
in areas not already covered by other routers, or to bridge around problematic terrain,
|
in areas not already covered by other routers, or to bridge around problematic terrain,
|
||||||
but should not be given priority over other routers in order to avoid unnecessaraily
|
but should not be given priority over other routers in order to avoid unnecessaraily
|
||||||
consuming hops. */
|
consuming hops. */
|
||||||
meshtastic_Config_DeviceConfig_Role_ROUTER_LATE = 11
|
meshtastic_Config_DeviceConfig_Role_ROUTER_LATE = 11,
|
||||||
|
/* Description: Treats packets from or to favorited nodes as ROUTER, and all other packets as CLIENT.
|
||||||
|
Technical Details: Used for stronger attic/roof nodes to distribute messages more widely
|
||||||
|
from weaker, indoor, or less-well-positioned nodes. Recommended for users with multiple nodes
|
||||||
|
where one CLIENT_BASE acts as a more powerful base station, such as an attic/roof node. */
|
||||||
|
meshtastic_Config_DeviceConfig_Role_CLIENT_BASE = 12
|
||||||
} meshtastic_Config_DeviceConfig_Role;
|
} meshtastic_Config_DeviceConfig_Role;
|
||||||
|
|
||||||
/* Defines the device's behavior for how messages are rebroadcast */
|
/* Defines the device's behavior for how messages are rebroadcast */
|
||||||
@@ -646,8 +651,8 @@ extern "C" {
|
|||||||
|
|
||||||
/* Helper constants for enums */
|
/* Helper constants for enums */
|
||||||
#define _meshtastic_Config_DeviceConfig_Role_MIN meshtastic_Config_DeviceConfig_Role_CLIENT
|
#define _meshtastic_Config_DeviceConfig_Role_MIN meshtastic_Config_DeviceConfig_Role_CLIENT
|
||||||
#define _meshtastic_Config_DeviceConfig_Role_MAX meshtastic_Config_DeviceConfig_Role_ROUTER_LATE
|
#define _meshtastic_Config_DeviceConfig_Role_MAX meshtastic_Config_DeviceConfig_Role_CLIENT_BASE
|
||||||
#define _meshtastic_Config_DeviceConfig_Role_ARRAYSIZE ((meshtastic_Config_DeviceConfig_Role)(meshtastic_Config_DeviceConfig_Role_ROUTER_LATE+1))
|
#define _meshtastic_Config_DeviceConfig_Role_ARRAYSIZE ((meshtastic_Config_DeviceConfig_Role)(meshtastic_Config_DeviceConfig_Role_CLIENT_BASE+1))
|
||||||
|
|
||||||
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN meshtastic_Config_DeviceConfig_RebroadcastMode_ALL
|
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN meshtastic_Config_DeviceConfig_RebroadcastMode_ALL
|
||||||
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_MAX meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY
|
#define _meshtastic_Config_DeviceConfig_RebroadcastMode_MAX meshtastic_Config_DeviceConfig_RebroadcastMode_CORE_PORTNUMS_ONLY
|
||||||
|
|||||||
@@ -141,7 +141,10 @@ void setupModules()
|
|||||||
detectionSensorModule = new DetectionSensorModule();
|
detectionSensorModule = new DetectionSensorModule();
|
||||||
#endif
|
#endif
|
||||||
#if !MESHTASTIC_EXCLUDE_ATAK
|
#if !MESHTASTIC_EXCLUDE_ATAK
|
||||||
|
if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TAK,
|
||||||
|
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER)) {
|
||||||
atakPluginModule = new AtakPluginModule();
|
atakPluginModule = new AtakPluginModule();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !MESHTASTIC_EXCLUDE_PKI
|
#if !MESHTASTIC_EXCLUDE_PKI
|
||||||
keyVerificationModule = new KeyVerificationModule();
|
keyVerificationModule = new KeyVerificationModule();
|
||||||
|
|||||||
@@ -1,27 +1,5 @@
|
|||||||
#include "../test_helpers.h"
|
#include "../test_helpers.h"
|
||||||
|
|
||||||
// test data initialization
|
|
||||||
const int from = 0x11223344;
|
|
||||||
const int to = 0x55667788;
|
|
||||||
const int id = 0x9999;
|
|
||||||
|
|
||||||
// Helper function to create a test encrypted packet
|
|
||||||
meshtastic_MeshPacket create_test_encrypted_packet(uint32_t from, uint32_t to, uint32_t id, const char *data)
|
|
||||||
{
|
|
||||||
meshtastic_MeshPacket packet = meshtastic_MeshPacket_init_zero;
|
|
||||||
packet.from = from;
|
|
||||||
packet.to = to;
|
|
||||||
packet.id = id;
|
|
||||||
packet.which_payload_variant = meshtastic_MeshPacket_encrypted_tag;
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
packet.encrypted.size = strlen(data);
|
|
||||||
memcpy(packet.encrypted.bytes, data, packet.encrypted.size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return packet;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function for all encrypted packet assertions
|
// Helper function for all encrypted packet assertions
|
||||||
void assert_encrypted_packet(const std::string &json, meshtastic_MeshPacket packet)
|
void assert_encrypted_packet(const std::string &json, meshtastic_MeshPacket packet)
|
||||||
{
|
{
|
||||||
@@ -61,58 +39,20 @@ void assert_encrypted_packet(const std::string &json, meshtastic_MeshPacket pack
|
|||||||
// Test encrypted packet serialization
|
// Test encrypted packet serialization
|
||||||
void test_encrypted_packet_serialization()
|
void test_encrypted_packet_serialization()
|
||||||
{
|
{
|
||||||
meshtastic_MeshPacket packet = meshtastic_MeshPacket_init_zero;
|
const char *data = "encrypted_payload_data";
|
||||||
packet.from = 0x11223344;
|
meshtastic_MeshPacket packet =
|
||||||
packet.to = 0x55667788;
|
create_test_packet(meshtastic_PortNum_TEXT_MESSAGE_APP, reinterpret_cast<const uint8_t *>(data), strlen(data),
|
||||||
packet.id = 0x9999;
|
meshtastic_MeshPacket_encrypted_tag);
|
||||||
packet.which_payload_variant = meshtastic_MeshPacket_encrypted_tag;
|
|
||||||
|
|
||||||
// Add some dummy encrypted data
|
|
||||||
const char *encrypted_data = "encrypted_payload_data";
|
|
||||||
packet.encrypted.size = strlen(encrypted_data);
|
|
||||||
memcpy(packet.encrypted.bytes, encrypted_data, packet.encrypted.size);
|
|
||||||
|
|
||||||
std::string json = MeshPacketSerializer::JsonSerializeEncrypted(&packet);
|
std::string json = MeshPacketSerializer::JsonSerializeEncrypted(&packet);
|
||||||
TEST_ASSERT_TRUE(json.length() > 0);
|
|
||||||
|
|
||||||
JSONValue *root = JSON::Parse(json.c_str());
|
assert_encrypted_packet(json, packet);
|
||||||
TEST_ASSERT_NOT_NULL(root);
|
|
||||||
TEST_ASSERT_TRUE(root->IsObject());
|
|
||||||
|
|
||||||
JSONObject jsonObj = root->AsObject();
|
|
||||||
|
|
||||||
// Check basic packet fields
|
|
||||||
TEST_ASSERT_TRUE(jsonObj.find("from") != jsonObj.end());
|
|
||||||
TEST_ASSERT_EQUAL(0x11223344, (uint32_t)jsonObj["from"]->AsNumber());
|
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(jsonObj.find("to") != jsonObj.end());
|
|
||||||
TEST_ASSERT_EQUAL(0x55667788, (uint32_t)jsonObj["to"]->AsNumber());
|
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(jsonObj.find("id") != jsonObj.end());
|
|
||||||
TEST_ASSERT_EQUAL(0x9999, (uint32_t)jsonObj["id"]->AsNumber());
|
|
||||||
|
|
||||||
// Check that it has encrypted data fields (not "payload" but "bytes" and "size")
|
|
||||||
TEST_ASSERT_TRUE(jsonObj.find("bytes") != jsonObj.end());
|
|
||||||
TEST_ASSERT_TRUE(jsonObj["bytes"]->IsString());
|
|
||||||
|
|
||||||
TEST_ASSERT_TRUE(jsonObj.find("size") != jsonObj.end());
|
|
||||||
TEST_ASSERT_EQUAL(22, (int)jsonObj["size"]->AsNumber()); // strlen("encrypted_payload_data") = 22
|
|
||||||
|
|
||||||
// The encrypted data should be hex-encoded
|
|
||||||
std::string encrypted_hex = jsonObj["bytes"]->AsString();
|
|
||||||
TEST_ASSERT_TRUE(encrypted_hex.length() > 0);
|
|
||||||
// Should be twice the size of the original data (hex encoding)
|
|
||||||
TEST_ASSERT_EQUAL(44, encrypted_hex.length()); // 22 * 2 = 44
|
|
||||||
|
|
||||||
delete root;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test empty encrypted packet
|
// Test empty encrypted packet
|
||||||
void test_empty_encrypted_packet()
|
void test_empty_encrypted_packet()
|
||||||
{
|
{
|
||||||
const char *data = "";
|
meshtastic_MeshPacket packet =
|
||||||
|
create_test_packet(meshtastic_PortNum_TEXT_MESSAGE_APP, nullptr, 0, meshtastic_MeshPacket_encrypted_tag);
|
||||||
meshtastic_MeshPacket packet = create_test_encrypted_packet(from, to, id, data);
|
|
||||||
std::string json = MeshPacketSerializer::JsonSerializeEncrypted(&packet);
|
std::string json = MeshPacketSerializer::JsonSerializeEncrypted(&packet);
|
||||||
|
|
||||||
assert_encrypted_packet(json, packet);
|
assert_encrypted_packet(json, packet);
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
// Forward declarations for test functions
|
// Forward declarations for test functions
|
||||||
void test_text_message_serialization();
|
void test_text_message_serialization();
|
||||||
|
void test_text_message_serialization_null();
|
||||||
|
void test_text_message_serialization_long_text();
|
||||||
|
void test_text_message_serialization_oversized();
|
||||||
|
void test_text_message_serialization_invalid_utf8();
|
||||||
void test_position_serialization();
|
void test_position_serialization();
|
||||||
void test_nodeinfo_serialization();
|
void test_nodeinfo_serialization();
|
||||||
void test_waypoint_serialization();
|
void test_waypoint_serialization();
|
||||||
@@ -14,6 +18,7 @@ void test_telemetry_environment_metrics_missing_fields();
|
|||||||
void test_telemetry_environment_metrics_complete_coverage();
|
void test_telemetry_environment_metrics_complete_coverage();
|
||||||
void test_telemetry_environment_metrics_unset_fields();
|
void test_telemetry_environment_metrics_unset_fields();
|
||||||
void test_encrypted_packet_serialization();
|
void test_encrypted_packet_serialization();
|
||||||
|
void test_empty_encrypted_packet();
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -21,6 +26,10 @@ void setup()
|
|||||||
|
|
||||||
// Text message tests
|
// Text message tests
|
||||||
RUN_TEST(test_text_message_serialization);
|
RUN_TEST(test_text_message_serialization);
|
||||||
|
RUN_TEST(test_text_message_serialization_null);
|
||||||
|
RUN_TEST(test_text_message_serialization_long_text);
|
||||||
|
RUN_TEST(test_text_message_serialization_oversized);
|
||||||
|
RUN_TEST(test_text_message_serialization_invalid_utf8);
|
||||||
|
|
||||||
// Position tests
|
// Position tests
|
||||||
RUN_TEST(test_position_serialization);
|
RUN_TEST(test_position_serialization);
|
||||||
@@ -41,6 +50,7 @@ void setup()
|
|||||||
|
|
||||||
// Encrypted packet test
|
// Encrypted packet test
|
||||||
RUN_TEST(test_encrypted_packet_serialization);
|
RUN_TEST(test_encrypted_packet_serialization);
|
||||||
|
RUN_TEST(test_empty_encrypted_packet);
|
||||||
|
|
||||||
UNITY_END();
|
UNITY_END();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
extends = esp32s3_base
|
extends = esp32s3_base
|
||||||
board = bpi_picow_esp32_s3
|
board = bpi_picow_esp32_s3
|
||||||
board_check = true
|
board_check = true
|
||||||
board_build.partitions = default_8MB.csv
|
board_build.partitions = partition-table-8MB.csv
|
||||||
;OpenOCD flash method
|
;OpenOCD flash method
|
||||||
;upload_protocol = esp-builtin
|
;upload_protocol = esp-builtin
|
||||||
;Normal method
|
;Normal method
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ platform_packages =
|
|||||||
|
|
||||||
board = seeed-sensecap-indicator
|
board = seeed-sensecap-indicator
|
||||||
board_check = true
|
board_check = true
|
||||||
board_build.partitions = default_8MB.csv
|
board_build.partitions = partition-table-8MB.csv
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
|
|
||||||
build_flags = ${esp32_base.build_flags}
|
build_flags = ${esp32_base.build_flags}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
[env:unphone]
|
[env:unphone]
|
||||||
extends = esp32s3_base
|
extends = esp32s3_base
|
||||||
board = unphone
|
board = unphone
|
||||||
board_build.partitions = default_8MB.csv
|
board_build.partitions = partition-table-8MB.csv
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
@@ -20,6 +20,7 @@ build_flags =
|
|||||||
-D UNPHONE_LORA=0
|
-D UNPHONE_LORA=0
|
||||||
-D UNPHONE_FACTORY_MODE=0
|
-D UNPHONE_FACTORY_MODE=0
|
||||||
-D USE_SX127x
|
-D USE_SX127x
|
||||||
|
-D SDCARD_CS=43
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${esp32s3_base.build_src_filter}
|
${esp32s3_base.build_src_filter}
|
||||||
@@ -41,6 +42,7 @@ build_flags =
|
|||||||
-D HAS_SCREEN=1
|
-D HAS_SCREEN=1
|
||||||
-D HAS_TFT=1
|
-D HAS_TFT=1
|
||||||
-D HAS_SDCARD
|
-D HAS_SDCARD
|
||||||
|
-D SDCARD_CS=43
|
||||||
-D DISPLAY_SET_RESOLUTION
|
-D DISPLAY_SET_RESOLUTION
|
||||||
-D RAM_SIZE=6144
|
-D RAM_SIZE=6144
|
||||||
-D LV_CACHE_DEF_SIZE=2097152
|
-D LV_CACHE_DEF_SIZE=2097152
|
||||||
|
|||||||
@@ -52,7 +52,6 @@
|
|||||||
#undef GPS_TX_PIN
|
#undef GPS_TX_PIN
|
||||||
|
|
||||||
#define SD_SPI_FREQUENCY 25000000
|
#define SD_SPI_FREQUENCY 25000000
|
||||||
#define SDCARD_CS 43
|
|
||||||
|
|
||||||
#define LED_PIN 13 // the red part of the RGB LED
|
#define LED_PIN 13 // the red part of the RGB LED
|
||||||
#define LED_STATE_ON 0 // State when LED is lit
|
#define LED_STATE_ON 0 // State when LED is lit
|
||||||
|
|||||||
Reference in New Issue
Block a user