mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 14:10:53 +00:00
Compare commits
25 Commits
v2.0.14.2b
...
v2.0.15.aa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aafbde0f10 | ||
|
|
f29beeb748 | ||
|
|
75ea6fd704 | ||
|
|
171c1df3fa | ||
|
|
e05a007fc6 | ||
|
|
30a1810e12 | ||
|
|
bdf3fe3f5c | ||
|
|
d9af4f46fa | ||
|
|
9d2fbec511 | ||
|
|
f45a25b358 | ||
|
|
92a43685a8 | ||
|
|
103f1992dd | ||
|
|
e229a67d25 | ||
|
|
a7153a7aa9 | ||
|
|
14372c7e35 | ||
|
|
a5f80167e0 | ||
|
|
654d38ed3f | ||
|
|
e01e830c0e | ||
|
|
db192481bd | ||
|
|
e8908784f9 | ||
|
|
de82119415 | ||
|
|
cda7e8b6a5 | ||
|
|
96f763dfa3 | ||
|
|
57b47cf1e1 | ||
|
|
7950739d85 |
@@ -22,9 +22,9 @@ def readProps(prefsLoc):
|
||||
isDirty = subprocess.check_output(
|
||||
['git', 'diff', 'HEAD']).decode("utf-8").strip()
|
||||
suffix = sha
|
||||
if isDirty:
|
||||
# short for 'dirty', we want to keep our verstrings source for protobuf reasons
|
||||
suffix = sha + "-d"
|
||||
# if isDirty:
|
||||
# # short for 'dirty', we want to keep our verstrings source for protobuf reasons
|
||||
# suffix = sha + "-d"
|
||||
verObj['long'] = "{}.{}.{}.{}".format(
|
||||
version["major"], version["minor"], version["build"], suffix)
|
||||
except:
|
||||
|
||||
Submodule protobufs updated: 8cb6ed3c91...0754d58205
@@ -190,7 +190,6 @@ bool GPS::setupGPS()
|
||||
// Switch to Vehicle Mode, since SoftRF enables Aviation < 2g
|
||||
_serial_gps->write("$PCAS11,3*1E\r\n");
|
||||
delay(250);
|
||||
|
||||
} else if (gnssModel == GNSS_MODEL_UBLOX) {
|
||||
|
||||
/*
|
||||
@@ -429,6 +428,10 @@ void GPS::publishUpdate()
|
||||
|
||||
int32_t GPS::runOnce()
|
||||
{
|
||||
// Repeaters have no need for GPS
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
|
||||
disable();
|
||||
|
||||
if (whileIdle()) {
|
||||
// if we have received valid NMEA claim we are connected
|
||||
setConnected();
|
||||
|
||||
@@ -310,6 +310,10 @@ void setup()
|
||||
// but we need to do this after main cpu iniot (esp32setup), because we need the random seed set
|
||||
nodeDB.init();
|
||||
|
||||
// If we're taking on the repeater role, use flood router
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
|
||||
router = new FloodingRouter();
|
||||
|
||||
playStartMelody();
|
||||
|
||||
// fixed screen override?
|
||||
|
||||
@@ -48,15 +48,13 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
||||
traceRouteModule->updateRoute(tosend);
|
||||
}
|
||||
|
||||
LOG_INFO("Rebroadcasting received floodmsg to neighbors", p);
|
||||
LOG_INFO("Rebroadcasting received floodmsg to neighbors\n");
|
||||
// Note: we are careful to resend using the original senders node id
|
||||
// We are careful not to call our hooked version of send() - because we don't want to check this again
|
||||
Router::send(tosend);
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("Not rebroadcasting. Role = Role_ClientMute\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("Ignoring a simple (0 id) broadcast\n");
|
||||
}
|
||||
|
||||
@@ -225,6 +225,25 @@ void NodeDB::installDefaultModuleConfig()
|
||||
initModuleConfigIntervals();
|
||||
}
|
||||
|
||||
void NodeDB::installRoleDefaults(meshtastic_Config_DeviceConfig_Role role)
|
||||
{
|
||||
if (role == meshtastic_Config_DeviceConfig_Role_ROUTER) {
|
||||
initConfigIntervals();
|
||||
initModuleConfigIntervals();
|
||||
} else if (role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||
config.display.screen_on_secs = 1;
|
||||
meshtastic_Channel &ch = channels.getByIndex(channels.getPrimaryIndex());
|
||||
meshtastic_ChannelSettings &channelSettings = ch.settings;
|
||||
uint8_t defaultpskIndex = 1;
|
||||
channelSettings.psk.bytes[0] = defaultpskIndex;
|
||||
channelSettings.psk.size = 1;
|
||||
} else if (role == meshtastic_Config_DeviceConfig_Role_TRACKER) {
|
||||
config.position.position_broadcast_smart_enabled = false;
|
||||
config.position.position_broadcast_secs = 120;
|
||||
config.position.gps_update_interval = 60;
|
||||
}
|
||||
}
|
||||
|
||||
void NodeDB::initModuleConfigIntervals()
|
||||
{
|
||||
moduleConfig.telemetry.device_update_interval = default_broadcast_interval_secs;
|
||||
@@ -609,13 +628,11 @@ void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSou
|
||||
LOG_INFO("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i,
|
||||
p.longitude_i, p.altitude);
|
||||
info->position = p;
|
||||
|
||||
} else if ((p.time > 0) && !p.latitude_i && !p.longitude_i && !p.timestamp && !p.location_source) {
|
||||
// FIXME SPECIAL TIME SETTING PACKET FROM EUD TO RADIO
|
||||
// (stop-gap fix for issue #900)
|
||||
LOG_DEBUG("updatePosition SPECIAL time setting time=%u\n", p.time);
|
||||
info->position.time = p.time;
|
||||
|
||||
} else {
|
||||
// Be careful to only update fields that have been set by the REMOTE sender
|
||||
// A lot of position reports don't have time populated. In that case, be careful to not blow away the time we
|
||||
|
||||
@@ -129,6 +129,8 @@ class NodeDB
|
||||
bool loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, void *dest_struct);
|
||||
bool saveProto(const char *filename, size_t protoSize, const pb_msgdesc_t *fields, const void *dest_struct);
|
||||
|
||||
void installRoleDefaults(meshtastic_Config_DeviceConfig_Role role);
|
||||
|
||||
private:
|
||||
/// Find a node in our DB, create an empty NodeInfo if missing
|
||||
meshtastic_NodeInfo *getOrCreateNode(NodeNum n);
|
||||
|
||||
@@ -300,8 +300,8 @@ void Router::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Rout
|
||||
|
||||
bool perhapsDecode(meshtastic_MeshPacket *p)
|
||||
{
|
||||
|
||||
// LOG_DEBUG("\n\n** perhapsDecode payloadVariant - %d\n\n", p->which_payloadVariant);
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
|
||||
return false;
|
||||
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag)
|
||||
return true; // If packet was already decoded just return
|
||||
@@ -367,7 +367,6 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
||||
{
|
||||
// If the packet is not yet encrypted, do so now
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||
|
||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded);
|
||||
|
||||
// Only allow encryption on the text message app.
|
||||
@@ -454,7 +453,7 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
||||
else
|
||||
printPacket("handleReceived(REMOTE)", p);
|
||||
} else {
|
||||
printPacket("packet decoding failed (no PSK?)", p);
|
||||
printPacket("packet decoding failed or skipped (no PSK?)", p);
|
||||
}
|
||||
|
||||
// call modules here
|
||||
|
||||
@@ -73,9 +73,6 @@ class Router : protected concurrency::OSThread
|
||||
*/
|
||||
void enqueueReceivedMessage(meshtastic_MeshPacket *p);
|
||||
|
||||
protected:
|
||||
friend class RoutingModule;
|
||||
|
||||
/**
|
||||
* Send a packet on a suitable interface. This routine will
|
||||
* later free() the packet to pool. This routine is not allowed to stall.
|
||||
@@ -85,6 +82,9 @@ class Router : protected concurrency::OSThread
|
||||
*/
|
||||
virtual ErrorCode send(meshtastic_MeshPacket *p);
|
||||
|
||||
protected:
|
||||
friend class RoutingModule;
|
||||
|
||||
/**
|
||||
* Should this incoming filter be dropped?
|
||||
*
|
||||
|
||||
@@ -112,13 +112,6 @@ typedef struct _meshtastic_AdminMessage {
|
||||
bool begin_edit_settings;
|
||||
/* Commits an open transaction for any edits made to config, module config, owner, and channel settings */
|
||||
bool commit_edit_settings;
|
||||
/* Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
|
||||
Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
|
||||
If you fail to do so, the radio will assume loss of comms and revert your changes.
|
||||
These messages are optional when changing the local node. */
|
||||
bool confirm_set_channel;
|
||||
/* TODO: REPLACE */
|
||||
bool confirm_set_radio;
|
||||
/* Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot)
|
||||
Only Implemented for ESP32 Devices. This needs to be issued to send a new main firmware via bluetooth. */
|
||||
int32_t reboot_ota_seconds;
|
||||
@@ -181,8 +174,6 @@ extern "C" {
|
||||
#define meshtastic_AdminMessage_set_ringtone_message_tag 37
|
||||
#define meshtastic_AdminMessage_begin_edit_settings_tag 64
|
||||
#define meshtastic_AdminMessage_commit_edit_settings_tag 65
|
||||
#define meshtastic_AdminMessage_confirm_set_channel_tag 66
|
||||
#define meshtastic_AdminMessage_confirm_set_radio_tag 67
|
||||
#define meshtastic_AdminMessage_reboot_ota_seconds_tag 95
|
||||
#define meshtastic_AdminMessage_exit_simulator_tag 96
|
||||
#define meshtastic_AdminMessage_reboot_seconds_tag 97
|
||||
@@ -214,8 +205,6 @@ X(a, STATIC, ONEOF, STRING, (payload_variant,set_canned_message_module_me
|
||||
X(a, STATIC, ONEOF, STRING, (payload_variant,set_ringtone_message,set_ringtone_message), 37) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,begin_edit_settings,begin_edit_settings), 64) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,commit_edit_settings,commit_edit_settings), 65) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,confirm_set_channel,confirm_set_channel), 66) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,confirm_set_radio,confirm_set_radio), 67) \
|
||||
X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_ota_seconds,reboot_ota_seconds), 95) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,exit_simulator,exit_simulator), 96) \
|
||||
X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_seconds,reboot_seconds), 97) \
|
||||
|
||||
@@ -19,11 +19,19 @@ typedef enum _meshtastic_Config_DeviceConfig_Role {
|
||||
meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE = 1,
|
||||
/* Router device role.
|
||||
Mesh packets will prefer to be routed over this node. This node will not be used by client apps.
|
||||
The wifi/ble radios and the oled screen will be put to sleep. */
|
||||
The wifi/ble radios and the oled screen will be put to sleep.
|
||||
This mode may still potentially have higher power usage due to it's preference in message rebroadcasting on the mesh. */
|
||||
meshtastic_Config_DeviceConfig_Role_ROUTER = 2,
|
||||
/* Router Client device role
|
||||
Mesh packets will prefer to be routed over this node. The Router Client can be used as both a Router and an app connected Client. */
|
||||
meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT = 3
|
||||
meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT = 3,
|
||||
/* Repeater device role
|
||||
Mesh packets will simply be rebroadcasted over this node. Nodes under this role node will not originate NodeInfo, Position, Telemetry
|
||||
or any other packet type. They will simply rebroadcast any mesh packets on the same frequency, channel num, spread factory, and coding rate. */
|
||||
meshtastic_Config_DeviceConfig_Role_REPEATER = 4,
|
||||
/* Tracker device role
|
||||
Position Mesh packets for will be higher priority and sent more frequently by default. */
|
||||
meshtastic_Config_DeviceConfig_Role_TRACKER = 5
|
||||
} meshtastic_Config_DeviceConfig_Role;
|
||||
|
||||
/* Bit field of boolean configuration options, indicating which optional
|
||||
@@ -419,8 +427,8 @@ extern "C" {
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _meshtastic_Config_DeviceConfig_Role_MIN meshtastic_Config_DeviceConfig_Role_CLIENT
|
||||
#define _meshtastic_Config_DeviceConfig_Role_MAX meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT
|
||||
#define _meshtastic_Config_DeviceConfig_Role_ARRAYSIZE ((meshtastic_Config_DeviceConfig_Role)(meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT+1))
|
||||
#define _meshtastic_Config_DeviceConfig_Role_MAX meshtastic_Config_DeviceConfig_Role_TRACKER
|
||||
#define _meshtastic_Config_DeviceConfig_Role_ARRAYSIZE ((meshtastic_Config_DeviceConfig_Role)(meshtastic_Config_DeviceConfig_Role_TRACKER+1))
|
||||
|
||||
#define _meshtastic_Config_PositionConfig_PositionFlags_MIN meshtastic_Config_PositionConfig_PositionFlags_UNSET
|
||||
#define _meshtastic_Config_PositionConfig_PositionFlags_MAX meshtastic_Config_PositionConfig_PositionFlags_SPEED
|
||||
|
||||
@@ -225,7 +225,7 @@ void AdminModule::handleSetOwner(const meshtastic_User &o)
|
||||
|
||||
void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||
{
|
||||
bool isRouter = (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER);
|
||||
auto existingRole = config.device.role;
|
||||
bool isRegionUnset = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
|
||||
|
||||
switch (c.which_payload_variant) {
|
||||
@@ -234,10 +234,8 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||
config.has_device = true;
|
||||
config.device = c.payload_variant.device;
|
||||
// If we're setting router role for the first time, install its intervals
|
||||
if (!isRouter && c.payload_variant.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) {
|
||||
nodeDB.initConfigIntervals();
|
||||
nodeDB.initModuleConfigIntervals();
|
||||
}
|
||||
if (existingRole != c.payload_variant.device.role)
|
||||
nodeDB.installRoleDefaults(c.payload_variant.device.role);
|
||||
break;
|
||||
case meshtastic_Config_position_tag:
|
||||
LOG_INFO("Setting config: Position\n");
|
||||
|
||||
@@ -33,51 +33,56 @@
|
||||
*/
|
||||
void setupModules()
|
||||
{
|
||||
if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||
#if HAS_BUTTON
|
||||
inputBroker = new InputBroker();
|
||||
inputBroker = new InputBroker();
|
||||
#endif
|
||||
adminModule = new AdminModule();
|
||||
nodeInfoModule = new NodeInfoModule();
|
||||
positionModule = new PositionModule();
|
||||
waypointModule = new WaypointModule();
|
||||
textMessageModule = new TextMessageModule();
|
||||
traceRouteModule = new TraceRouteModule();
|
||||
adminModule = new AdminModule();
|
||||
nodeInfoModule = new NodeInfoModule();
|
||||
positionModule = new PositionModule();
|
||||
waypointModule = new WaypointModule();
|
||||
textMessageModule = new TextMessageModule();
|
||||
traceRouteModule = new TraceRouteModule();
|
||||
|
||||
// Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance
|
||||
// to a global variable.
|
||||
// Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance
|
||||
// to a global variable.
|
||||
|
||||
new RemoteHardwareModule();
|
||||
new ReplyModule();
|
||||
new RemoteHardwareModule();
|
||||
new ReplyModule();
|
||||
#if HAS_BUTTON
|
||||
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
||||
rotaryEncoderInterruptImpl1->init();
|
||||
upDownInterruptImpl1 = new UpDownInterruptImpl1();
|
||||
upDownInterruptImpl1->init();
|
||||
cardKbI2cImpl = new CardKbI2cImpl();
|
||||
cardKbI2cImpl->init();
|
||||
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
||||
rotaryEncoderInterruptImpl1->init();
|
||||
upDownInterruptImpl1 = new UpDownInterruptImpl1();
|
||||
upDownInterruptImpl1->init();
|
||||
cardKbI2cImpl = new CardKbI2cImpl();
|
||||
cardKbI2cImpl->init();
|
||||
#endif
|
||||
#if HAS_SCREEN
|
||||
cannedMessageModule = new CannedMessageModule();
|
||||
cannedMessageModule = new CannedMessageModule();
|
||||
#endif
|
||||
#if HAS_TELEMETRY
|
||||
new DeviceTelemetryModule();
|
||||
new EnvironmentTelemetryModule();
|
||||
new DeviceTelemetryModule();
|
||||
new EnvironmentTelemetryModule();
|
||||
#endif
|
||||
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
new SerialModule();
|
||||
new SerialModule();
|
||||
#endif
|
||||
#ifdef ARCH_ESP32
|
||||
// Only run on an esp32 based device.
|
||||
audioModule = new AudioModule();
|
||||
externalNotificationModule = new ExternalNotificationModule();
|
||||
// Only run on an esp32 based device.
|
||||
audioModule = new AudioModule();
|
||||
externalNotificationModule = new ExternalNotificationModule();
|
||||
|
||||
storeForwardModule = new StoreForwardModule();
|
||||
storeForwardModule = new StoreForwardModule();
|
||||
|
||||
new RangeTestModule();
|
||||
new RangeTestModule();
|
||||
#elif defined(ARCH_NRF52)
|
||||
externalNotificationModule = new ExternalNotificationModule();
|
||||
externalNotificationModule = new ExternalNotificationModule();
|
||||
#endif
|
||||
|
||||
// NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra acks
|
||||
// NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra
|
||||
// acks
|
||||
} else {
|
||||
adminModule = new AdminModule();
|
||||
}
|
||||
routingModule = new RoutingModule();
|
||||
}
|
||||
|
||||
@@ -129,7 +129,10 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies)
|
||||
meshtastic_MeshPacket *p = allocReply();
|
||||
p->to = dest;
|
||||
p->decoded.want_response = wantReplies;
|
||||
p->priority = meshtastic_MeshPacket_Priority_BACKGROUND;
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER)
|
||||
p->priority = meshtastic_MeshPacket_Priority_RELIABLE;
|
||||
else
|
||||
p->priority = meshtastic_MeshPacket_Priority_BACKGROUND;
|
||||
prevPacketId = p->id;
|
||||
|
||||
service.sendToMesh(p, RX_SRC_LOCAL, true);
|
||||
@@ -161,7 +164,6 @@ int32_t PositionModule::runOnce()
|
||||
sendOurPosition(NODENUM_BROADCAST, requestReplies);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (config.position.position_broadcast_smart_enabled) {
|
||||
|
||||
// Only send packets if the channel is less than 25% utilized.
|
||||
|
||||
@@ -24,6 +24,8 @@ bool RoutingModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mesh
|
||||
|
||||
meshtastic_MeshPacket *RoutingModule::allocReply()
|
||||
{
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
|
||||
return NULL;
|
||||
assert(currentRequest);
|
||||
|
||||
// We only consider making replies if the request was a legit routing packet (not just something we were sniffing)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[VERSION]
|
||||
major = 2
|
||||
minor = 0
|
||||
build = 14
|
||||
build = 15
|
||||
|
||||
Reference in New Issue
Block a user