mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 14:42:05 +00:00
Merge branch 'master' into RCWL-9620
This commit is contained in:
commit
9fb6148aff
@ -1,6 +1,6 @@
|
|||||||
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform = https://github.com/meshtastic/platform-native.git#659e49346aa33008b150dfb206b1817ddabc7132
|
platform = https://github.com/meshtastic/platform-native.git#9881bf3721d610cccacf5ae8e3a07839cce75d63
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
@ -24,7 +24,7 @@ lib_deps =
|
|||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
${networking_base.lib_deps}
|
${networking_base.lib_deps}
|
||||||
rweather/Crypto@^0.4.0
|
rweather/Crypto@^0.4.0
|
||||||
https://github.com/lovyan03/LovyanGFX.git#d35e60f269dfecbb18a8cb0fd07d594c2fb7e7a8
|
https://github.com/lovyan03/LovyanGFX.git#5a39989aa2c9492572255b22f033843ec8900233
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags}
|
${arduino_base.build_flags}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
"extra_flags": [
|
"extra_flags": [
|
||||||
"-DBOARD_HAS_PSRAM",
|
"-DBOARD_HAS_PSRAM",
|
||||||
"-DLILYGO_TBEAM_S3_CORE",
|
"-DLILYGO_TBEAM_S3_CORE",
|
||||||
|
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||||
"-DARDUINO_USB_MODE=1",
|
"-DARDUINO_USB_MODE=1",
|
||||||
"-DARDUINO_RUNNING_CORE=1",
|
"-DARDUINO_RUNNING_CORE=1",
|
||||||
"-DARDUINO_EVENT_RUNNING_CORE=1"
|
"-DARDUINO_EVENT_RUNNING_CORE=1"
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 86640f20db7b9b5be42949d18e8d96ad10d47a68
|
Subproject commit e21899aa6b2b49863cfa2758e5e3b6faacf04bba
|
@ -196,7 +196,6 @@ int32_t ButtonThread::runOnce()
|
|||||||
#ifdef BUTTON_PIN_TOUCH
|
#ifdef BUTTON_PIN_TOUCH
|
||||||
case BUTTON_EVENT_TOUCH_LONG_PRESSED: {
|
case BUTTON_EVENT_TOUCH_LONG_PRESSED: {
|
||||||
LOG_BUTTON("Touch press!\n");
|
LOG_BUTTON("Touch press!\n");
|
||||||
if (config.display.wake_on_tap_or_motion) {
|
|
||||||
if (screen) {
|
if (screen) {
|
||||||
// Wake if asleep
|
// Wake if asleep
|
||||||
if (powerFSM.getState() == &stateDARK)
|
if (powerFSM.getState() == &stateDARK)
|
||||||
@ -205,7 +204,6 @@ int32_t ButtonThread::runOnce()
|
|||||||
// Update display (legacy behaviour)
|
// Update display (legacy behaviour)
|
||||||
screen->forceDisplay();
|
screen->forceDisplay();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // BUTTON_PIN_TOUCH
|
#endif // BUTTON_PIN_TOUCH
|
||||||
|
@ -223,7 +223,17 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
raw = raw / BATTERY_SENSE_SAMPLES;
|
raw = raw / BATTERY_SENSE_SAMPLES;
|
||||||
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / pow(2, BATTERY_SENSE_RESOLUTION_BITS)) * raw;
|
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / pow(2, BATTERY_SENSE_RESOLUTION_BITS)) * raw;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!initial_read_done) {
|
||||||
|
// Flush the smoothing filter with an ADC reading, if the reading is plausibly correct
|
||||||
|
if (scaled > last_read_value)
|
||||||
|
last_read_value = scaled;
|
||||||
|
initial_read_done = true;
|
||||||
|
} else {
|
||||||
|
// Already initialized - filter this reading
|
||||||
last_read_value += (scaled - last_read_value) * 0.5; // Virtual LPF
|
last_read_value += (scaled - last_read_value) * 0.5; // Virtual LPF
|
||||||
|
}
|
||||||
|
|
||||||
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u filtered=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled), (uint32_t)
|
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u filtered=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled), (uint32_t)
|
||||||
// (last_read_value));
|
// (last_read_value));
|
||||||
}
|
}
|
||||||
@ -357,6 +367,8 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
const float noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS;
|
const float noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS;
|
||||||
// Start value from minimum voltage for the filter to not start from 0
|
// Start value from minimum voltage for the filter to not start from 0
|
||||||
// that could trigger some events.
|
// that could trigger some events.
|
||||||
|
// This value is over-written by the first ADC reading, it the voltage seems reasonable.
|
||||||
|
bool initial_read_done = false;
|
||||||
float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS);
|
float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS);
|
||||||
uint32_t last_read_time_ms = 0;
|
uint32_t last_read_time_ms = 0;
|
||||||
|
|
||||||
|
@ -1467,7 +1467,7 @@ bool GPS::lookForLocation()
|
|||||||
#endif // GPS_EXTRAVERBOSE
|
#endif // GPS_EXTRAVERBOSE
|
||||||
|
|
||||||
// Is this a new point or are we re-reading the previous one?
|
// Is this a new point or are we re-reading the previous one?
|
||||||
if (!reader.location.isUpdated())
|
if (!reader.location.isUpdated() && !reader.altitude.isUpdated())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check if a complete GPS solution set is available for reading
|
// check if a complete GPS solution set is available for reading
|
||||||
|
@ -356,7 +356,7 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_panel_instance = new lgfx::Panel_ILI9341;
|
_panel_instance = new lgfx::Panel_ILI9341;
|
||||||
auto buscfg = _bus_instance.config();
|
auto buscfg = _bus_instance.config();
|
||||||
buscfg.spi_mode = 0;
|
buscfg.spi_mode = 0;
|
||||||
_bus_instance.spi_device(DisplaySPI);
|
buscfg.spi_host = settingsMap[displayspidev];
|
||||||
|
|
||||||
buscfg.pin_dc = settingsMap[displayDC]; // Set SPI DC pin number (-1 = disable)
|
buscfg.pin_dc = settingsMap[displayDC]; // Set SPI DC pin number (-1 = disable)
|
||||||
|
|
||||||
@ -397,6 +397,8 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
touch_cfg.offset_rotation = 1;
|
touch_cfg.offset_rotation = 1;
|
||||||
if (settingsMap[touchscreenI2CAddr] != -1) {
|
if (settingsMap[touchscreenI2CAddr] != -1) {
|
||||||
touch_cfg.i2c_addr = settingsMap[touchscreenI2CAddr];
|
touch_cfg.i2c_addr = settingsMap[touchscreenI2CAddr];
|
||||||
|
} else {
|
||||||
|
touch_cfg.spi_host = settingsMap[touchscreenspidev];
|
||||||
}
|
}
|
||||||
|
|
||||||
_touch_instance->config(touch_cfg);
|
_touch_instance->config(touch_cfg);
|
||||||
|
14
src/main.cpp
14
src/main.cpp
@ -694,6 +694,12 @@ void setup()
|
|||||||
// Now that the mesh service is created, create any modules
|
// Now that the mesh service is created, create any modules
|
||||||
setupModules();
|
setupModules();
|
||||||
|
|
||||||
|
#ifdef LED_PIN
|
||||||
|
// Turn LED off after boot, if heartbeat by config
|
||||||
|
if (config.device.led_heartbeat_disabled)
|
||||||
|
digitalWrite(LED_PIN, LOW ^ LED_INVERTED);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Do this after service.init (because that clears error_code)
|
// Do this after service.init (because that clears error_code)
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
if (!pmu_found)
|
if (!pmu_found)
|
||||||
@ -730,7 +736,7 @@ void setup()
|
|||||||
if (settingsMap[use_sx1262]) {
|
if (settingsMap[use_sx1262]) {
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
LOG_DEBUG("Attempting to activate sx1262 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
LOG_DEBUG("Attempting to activate sx1262 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(*LoraSPI, spiSettings);
|
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||||
rIf = new SX1262Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
rIf = new SX1262Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||||
settingsMap[busy]);
|
settingsMap[busy]);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
@ -744,7 +750,7 @@ void setup()
|
|||||||
} else if (settingsMap[use_rf95]) {
|
} else if (settingsMap[use_rf95]) {
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
LOG_DEBUG("Attempting to activate rf95 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
LOG_DEBUG("Attempting to activate rf95 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(*LoraSPI, spiSettings);
|
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||||
rIf = new RF95Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
rIf = new RF95Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||||
settingsMap[busy]);
|
settingsMap[busy]);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
@ -759,7 +765,7 @@ void setup()
|
|||||||
} else if (settingsMap[use_sx1280]) {
|
} else if (settingsMap[use_sx1280]) {
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
LOG_DEBUG("Attempting to activate sx1280 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
LOG_DEBUG("Attempting to activate sx1280 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(*LoraSPI, spiSettings);
|
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||||
rIf = new SX1280Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
rIf = new SX1280Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||||
settingsMap[busy]);
|
settingsMap[busy]);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
@ -774,7 +780,7 @@ void setup()
|
|||||||
} else if (settingsMap[use_sx1268]) {
|
} else if (settingsMap[use_sx1268]) {
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
LOG_DEBUG("Attempting to activate sx1268 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
LOG_DEBUG("Attempting to activate sx1268 radio on SPI port %s\n", settingsStrings[spidev].c_str());
|
||||||
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(*LoraSPI, spiSettings);
|
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||||
rIf = new SX1268Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
rIf = new SX1268Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset],
|
||||||
settingsMap[busy]);
|
settingsMap[busy]);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
|
@ -35,11 +35,10 @@ bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
|||||||
|
|
||||||
void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c)
|
void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c)
|
||||||
{
|
{
|
||||||
bool isAck =
|
bool isAckorReply = (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) && (p->decoded.request_id != 0);
|
||||||
((c && c->error_reason == meshtastic_Routing_Error_NONE)); // consider only ROUTING_APP message without error as ACK
|
if (isAckorReply && p->to != getNodeNum() && p->to != NODENUM_BROADCAST) {
|
||||||
if (isAck && p->to != getNodeNum()) {
|
// do not flood direct message that is ACKed or replied to
|
||||||
// do not flood direct message that is ACKed
|
LOG_DEBUG("Receiving an ACK or reply not for me, but don't need to rebroadcast this direct message anymore.\n");
|
||||||
LOG_DEBUG("Receiving an ACK not for me, but don't need to rebroadcast this direct message anymore.\n");
|
|
||||||
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
|
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
|
||||||
}
|
}
|
||||||
if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
|
if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
|
||||||
|
@ -193,10 +193,7 @@ void MeshService::handleToRadio(meshtastic_MeshPacket &p)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (p.from != 0) { // We don't let phones assign nodenums to their sent messages
|
if (p.from != 0) { // We don't let phones assign nodenums to their sent messages
|
||||||
LOG_WARN("phone tried to pick a nodenum, we don't allow that.\n");
|
|
||||||
p.from = 0;
|
p.from = 0;
|
||||||
} else {
|
|
||||||
// p.from = nodeDB->getNodeNum();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.id == 0)
|
if (p.id == 0)
|
||||||
|
@ -352,9 +352,6 @@ void NodeDB::installDefaultModuleConfig()
|
|||||||
moduleConfig.external_notification.alert_message = true;
|
moduleConfig.external_notification.alert_message = true;
|
||||||
moduleConfig.external_notification.output_ms = 100;
|
moduleConfig.external_notification.output_ms = 100;
|
||||||
moduleConfig.external_notification.active = true;
|
moduleConfig.external_notification.active = true;
|
||||||
#endif
|
|
||||||
#ifdef TTGO_T_ECHO
|
|
||||||
config.display.wake_on_tap_or_motion = true; // Enable touch button for screen-on / refresh
|
|
||||||
#endif
|
#endif
|
||||||
moduleConfig.has_canned_message = true;
|
moduleConfig.has_canned_message = true;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ extern const pb_msgdesc_t meshtastic_ChannelSet_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_APPONLY_PB_H_MAX_SIZE meshtastic_ChannelSet_size
|
#define MESHTASTIC_MESHTASTIC_APPONLY_PB_H_MAX_SIZE meshtastic_ChannelSet_size
|
||||||
#define meshtastic_ChannelSet_size 658
|
#define meshtastic_ChannelSet_size 674
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -34,6 +34,9 @@ typedef enum _meshtastic_Channel_Role {
|
|||||||
typedef struct _meshtastic_ModuleSettings {
|
typedef struct _meshtastic_ModuleSettings {
|
||||||
/* Bits of precision for the location sent in position packets. */
|
/* Bits of precision for the location sent in position packets. */
|
||||||
uint32_t position_precision;
|
uint32_t position_precision;
|
||||||
|
/* Controls whether or not the phone / clients should mute the current channel
|
||||||
|
Useful for noisy public channels you don't necessarily want to disable */
|
||||||
|
bool is_client_muted;
|
||||||
} meshtastic_ModuleSettings;
|
} meshtastic_ModuleSettings;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(32) meshtastic_ChannelSettings_psk_t;
|
typedef PB_BYTES_ARRAY_T(32) meshtastic_ChannelSettings_psk_t;
|
||||||
@ -126,14 +129,15 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_ChannelSettings_init_default {0, {0, {0}}, "", 0, 0, 0, false, meshtastic_ModuleSettings_init_default}
|
#define meshtastic_ChannelSettings_init_default {0, {0, {0}}, "", 0, 0, 0, false, meshtastic_ModuleSettings_init_default}
|
||||||
#define meshtastic_ModuleSettings_init_default {0}
|
#define meshtastic_ModuleSettings_init_default {0, 0}
|
||||||
#define meshtastic_Channel_init_default {0, false, meshtastic_ChannelSettings_init_default, _meshtastic_Channel_Role_MIN}
|
#define meshtastic_Channel_init_default {0, false, meshtastic_ChannelSettings_init_default, _meshtastic_Channel_Role_MIN}
|
||||||
#define meshtastic_ChannelSettings_init_zero {0, {0, {0}}, "", 0, 0, 0, false, meshtastic_ModuleSettings_init_zero}
|
#define meshtastic_ChannelSettings_init_zero {0, {0, {0}}, "", 0, 0, 0, false, meshtastic_ModuleSettings_init_zero}
|
||||||
#define meshtastic_ModuleSettings_init_zero {0}
|
#define meshtastic_ModuleSettings_init_zero {0, 0}
|
||||||
#define meshtastic_Channel_init_zero {0, false, meshtastic_ChannelSettings_init_zero, _meshtastic_Channel_Role_MIN}
|
#define meshtastic_Channel_init_zero {0, false, meshtastic_ChannelSettings_init_zero, _meshtastic_Channel_Role_MIN}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_ModuleSettings_position_precision_tag 1
|
#define meshtastic_ModuleSettings_position_precision_tag 1
|
||||||
|
#define meshtastic_ModuleSettings_is_client_muted_tag 2
|
||||||
#define meshtastic_ChannelSettings_channel_num_tag 1
|
#define meshtastic_ChannelSettings_channel_num_tag 1
|
||||||
#define meshtastic_ChannelSettings_psk_tag 2
|
#define meshtastic_ChannelSettings_psk_tag 2
|
||||||
#define meshtastic_ChannelSettings_name_tag 3
|
#define meshtastic_ChannelSettings_name_tag 3
|
||||||
@ -159,7 +163,8 @@ X(a, STATIC, OPTIONAL, MESSAGE, module_settings, 7)
|
|||||||
#define meshtastic_ChannelSettings_module_settings_MSGTYPE meshtastic_ModuleSettings
|
#define meshtastic_ChannelSettings_module_settings_MSGTYPE meshtastic_ModuleSettings
|
||||||
|
|
||||||
#define meshtastic_ModuleSettings_FIELDLIST(X, a) \
|
#define meshtastic_ModuleSettings_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, position_precision, 1)
|
X(a, STATIC, SINGULAR, UINT32, position_precision, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, is_client_muted, 2)
|
||||||
#define meshtastic_ModuleSettings_CALLBACK NULL
|
#define meshtastic_ModuleSettings_CALLBACK NULL
|
||||||
#define meshtastic_ModuleSettings_DEFAULT NULL
|
#define meshtastic_ModuleSettings_DEFAULT NULL
|
||||||
|
|
||||||
@ -182,9 +187,9 @@ extern const pb_msgdesc_t meshtastic_Channel_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_MAX_SIZE meshtastic_Channel_size
|
#define MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_MAX_SIZE meshtastic_Channel_size
|
||||||
#define meshtastic_ChannelSettings_size 70
|
#define meshtastic_ChannelSettings_size 72
|
||||||
#define meshtastic_Channel_size 85
|
#define meshtastic_Channel_size 87
|
||||||
#define meshtastic_ModuleSettings_size 6
|
#define meshtastic_ModuleSettings_size 8
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -306,7 +306,7 @@ extern const pb_msgdesc_t meshtastic_OEMStore_msg;
|
|||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
/* meshtastic_DeviceState_size depends on runtime parameters */
|
/* meshtastic_DeviceState_size depends on runtime parameters */
|
||||||
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_OEMStore_size
|
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_OEMStore_size
|
||||||
#define meshtastic_ChannelFile_size 702
|
#define meshtastic_ChannelFile_size 718
|
||||||
#define meshtastic_NodeInfoLite_size 166
|
#define meshtastic_NodeInfoLite_size 166
|
||||||
#define meshtastic_OEMStore_size 3346
|
#define meshtastic_OEMStore_size 3346
|
||||||
#define meshtastic_PositionLite_size 28
|
#define meshtastic_PositionLite_size 28
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
#include "mqtt/MQTT.h"
|
#include "mqtt/MQTT.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !MESHTASTIC_EXCLUDE_GPS
|
||||||
|
#include "GPS.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
AdminModule *adminModule;
|
AdminModule *adminModule;
|
||||||
bool hasOpenEditTransaction;
|
bool hasOpenEditTransaction;
|
||||||
|
|
||||||
@ -217,6 +221,10 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
nodeDB->setLocalPosition(r->set_fixed_position);
|
nodeDB->setLocalPosition(r->set_fixed_position);
|
||||||
config.position.fixed_position = true;
|
config.position.fixed_position = true;
|
||||||
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
|
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
|
||||||
|
#if !MESHTASTIC_EXCLUDE_GPS
|
||||||
|
if (gps != nullptr)
|
||||||
|
gps->enable();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,23 @@ bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
|
|||||||
return false; // Let others look at this message also if they want
|
return false; // Let others look at this message also if they want
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PositionModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtastic_Position *p)
|
||||||
|
{
|
||||||
|
// Phone position packets need to be truncated to the channel precision
|
||||||
|
if (nodeDB->getNodeNum() == getFrom(&mp) && (precision < 32 && precision > 0)) {
|
||||||
|
LOG_DEBUG("Truncating phone position to channel precision %i\n", precision);
|
||||||
|
p->latitude_i = p->latitude_i & (UINT32_MAX << (32 - precision));
|
||||||
|
p->longitude_i = p->longitude_i & (UINT32_MAX << (32 - precision));
|
||||||
|
|
||||||
|
// We want the imprecise position to be the middle of the possible location, not
|
||||||
|
p->latitude_i += (1 << (31 - precision));
|
||||||
|
p->longitude_i += (1 << (31 - precision));
|
||||||
|
|
||||||
|
mp.decoded.payload.size =
|
||||||
|
pb_encode_to_bytes(mp.decoded.payload.bytes, sizeof(mp.decoded.payload.bytes), &meshtastic_Position_msg, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PositionModule::trySetRtc(meshtastic_Position p, bool isLocal)
|
void PositionModule::trySetRtc(meshtastic_Position p, bool isLocal)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
@ -42,6 +42,8 @@ class PositionModule : public ProtobufModule<meshtastic_Position>, private concu
|
|||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Position *p) override;
|
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Position *p) override;
|
||||||
|
|
||||||
|
virtual void alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtastic_Position *p) override;
|
||||||
|
|
||||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||||
* so that subclasses can (optionally) send a response back to the original sender. */
|
* so that subclasses can (optionally) send a response back to the original sender. */
|
||||||
virtual meshtastic_MeshPacket *allocReply() override;
|
virtual meshtastic_MeshPacket *allocReply() override;
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
HardwareSPI *DisplaySPI;
|
|
||||||
HardwareSPI *LoraSPI;
|
|
||||||
std::map<configNames, int> settingsMap;
|
std::map<configNames, int> settingsMap;
|
||||||
std::map<configNames, std::string> settingsStrings;
|
std::map<configNames, std::string> settingsStrings;
|
||||||
char *configPath = nullptr;
|
char *configPath = nullptr;
|
||||||
@ -76,7 +74,21 @@ void portduinoCustomInit()
|
|||||||
void portduinoSetup()
|
void portduinoSetup()
|
||||||
{
|
{
|
||||||
printf("Setting up Meshtastic on Portduino...\n");
|
printf("Setting up Meshtastic on Portduino...\n");
|
||||||
gpioInit();
|
int max_GPIO = 0;
|
||||||
|
configNames GPIO_lines[] = {cs,
|
||||||
|
irq,
|
||||||
|
busy,
|
||||||
|
reset,
|
||||||
|
txen,
|
||||||
|
rxen,
|
||||||
|
displayDC,
|
||||||
|
displayCS,
|
||||||
|
displayBacklight,
|
||||||
|
displayBacklightPWMChannel,
|
||||||
|
displayReset,
|
||||||
|
touchscreenCS,
|
||||||
|
touchscreenIRQ,
|
||||||
|
user};
|
||||||
|
|
||||||
std::string gpioChipName = "gpiochip";
|
std::string gpioChipName = "gpiochip";
|
||||||
settingsStrings[i2cdev] = "";
|
settingsStrings[i2cdev] = "";
|
||||||
@ -159,6 +171,15 @@ void portduinoSetup()
|
|||||||
gpioChipName += std::to_string(settingsMap[gpiochip]);
|
gpioChipName += std::to_string(settingsMap[gpiochip]);
|
||||||
|
|
||||||
settingsStrings[spidev] = "/dev/" + yamlConfig["Lora"]["spidev"].as<std::string>("spidev0.0");
|
settingsStrings[spidev] = "/dev/" + yamlConfig["Lora"]["spidev"].as<std::string>("spidev0.0");
|
||||||
|
if (settingsStrings[spidev].length() == 14) {
|
||||||
|
int x = settingsStrings[spidev].at(11) - '0';
|
||||||
|
int y = settingsStrings[spidev].at(13) - '0';
|
||||||
|
if (x >= 0 && x < 10 && y >= 0 && y < 10) {
|
||||||
|
settingsMap[spidev] = x + y << 4;
|
||||||
|
settingsMap[displayspidev] = settingsMap[spidev];
|
||||||
|
settingsMap[touchscreenspidev] = settingsMap[spidev];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (yamlConfig["GPIO"]) {
|
if (yamlConfig["GPIO"]) {
|
||||||
settingsMap[user] = yamlConfig["GPIO"]["User"].as<int>(RADIOLIB_NC);
|
settingsMap[user] = yamlConfig["GPIO"]["User"].as<int>(RADIOLIB_NC);
|
||||||
@ -208,6 +229,14 @@ void portduinoSetup()
|
|||||||
settingsMap[displayBusFrequency] = yamlConfig["Display"]["BusFrequency"].as<int>(40000000);
|
settingsMap[displayBusFrequency] = yamlConfig["Display"]["BusFrequency"].as<int>(40000000);
|
||||||
if (yamlConfig["Display"]["spidev"]) {
|
if (yamlConfig["Display"]["spidev"]) {
|
||||||
settingsStrings[displayspidev] = "/dev/" + yamlConfig["Display"]["spidev"].as<std::string>("spidev0.1");
|
settingsStrings[displayspidev] = "/dev/" + yamlConfig["Display"]["spidev"].as<std::string>("spidev0.1");
|
||||||
|
if (settingsStrings[displayspidev].length() == 14) {
|
||||||
|
int x = settingsStrings[displayspidev].at(11) - '0';
|
||||||
|
int y = settingsStrings[displayspidev].at(13) - '0';
|
||||||
|
if (x >= 0 && x < 10 && y >= 0 && y < 10) {
|
||||||
|
settingsMap[displayspidev] = x + y << 4;
|
||||||
|
settingsMap[touchscreenspidev] = settingsMap[displayspidev];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settingsMap[touchscreenModule] = no_touchscreen;
|
settingsMap[touchscreenModule] = no_touchscreen;
|
||||||
@ -227,6 +256,13 @@ void portduinoSetup()
|
|||||||
settingsMap[touchscreenI2CAddr] = yamlConfig["Touchscreen"]["I2CAddr"].as<int>(-1);
|
settingsMap[touchscreenI2CAddr] = yamlConfig["Touchscreen"]["I2CAddr"].as<int>(-1);
|
||||||
if (yamlConfig["Touchscreen"]["spidev"]) {
|
if (yamlConfig["Touchscreen"]["spidev"]) {
|
||||||
settingsStrings[touchscreenspidev] = "/dev/" + yamlConfig["Touchscreen"]["spidev"].as<std::string>("");
|
settingsStrings[touchscreenspidev] = "/dev/" + yamlConfig["Touchscreen"]["spidev"].as<std::string>("");
|
||||||
|
if (settingsStrings[touchscreenspidev].length() == 14) {
|
||||||
|
int x = settingsStrings[touchscreenspidev].at(11) - '0';
|
||||||
|
int y = settingsStrings[touchscreenspidev].at(13) - '0';
|
||||||
|
if (x >= 0 && x < 10 && y >= 0 && y < 10) {
|
||||||
|
settingsMap[touchscreenspidev] = x + y << 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (yamlConfig["Input"]) {
|
if (yamlConfig["Input"]) {
|
||||||
@ -245,6 +281,13 @@ void portduinoSetup()
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (configNames i : GPIO_lines) {
|
||||||
|
if (settingsMap[i] > max_GPIO)
|
||||||
|
max_GPIO = settingsMap[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
gpioInit(max_GPIO + 1); // Done here so we can inform Portduino how many GPIOs we need.
|
||||||
|
|
||||||
// Need to bind all the configured GPIO pins so they're not simulated
|
// Need to bind all the configured GPIO pins so they're not simulated
|
||||||
if (settingsMap.count(cs) > 0 && settingsMap[cs] != RADIOLIB_NC) {
|
if (settingsMap.count(cs) > 0 && settingsMap[cs] != RADIOLIB_NC) {
|
||||||
if (initGPIOPin(settingsMap[cs], gpioChipName) != ERRNO_OK) {
|
if (initGPIOPin(settingsMap[cs], gpioChipName) != ERRNO_OK) {
|
||||||
@ -298,27 +341,9 @@ void portduinoSetup()
|
|||||||
if (settingsMap[touchscreenIRQ] > 0)
|
if (settingsMap[touchscreenIRQ] > 0)
|
||||||
initGPIOPin(settingsMap[touchscreenIRQ], gpioChipName);
|
initGPIOPin(settingsMap[touchscreenIRQ], gpioChipName);
|
||||||
}
|
}
|
||||||
|
if (settingsStrings[spidev] != "") {
|
||||||
// if we specify a touchscreen dev, that is SPI.
|
|
||||||
// else if we specify a screen dev, that is SPI
|
|
||||||
// else if we specify a LoRa dev, that is SPI.
|
|
||||||
if (settingsStrings[touchscreenspidev] != "") {
|
|
||||||
SPI.begin(settingsStrings[touchscreenspidev].c_str());
|
|
||||||
DisplaySPI = new HardwareSPI;
|
|
||||||
DisplaySPI->begin(settingsStrings[displayspidev].c_str());
|
|
||||||
LoraSPI = new HardwareSPI;
|
|
||||||
LoraSPI->begin(settingsStrings[spidev].c_str());
|
|
||||||
} else if (settingsStrings[displayspidev] != "") {
|
|
||||||
SPI.begin(settingsStrings[displayspidev].c_str());
|
|
||||||
DisplaySPI = &SPI;
|
|
||||||
LoraSPI = new HardwareSPI;
|
|
||||||
LoraSPI->begin(settingsStrings[spidev].c_str());
|
|
||||||
} else {
|
|
||||||
SPI.begin(settingsStrings[spidev].c_str());
|
SPI.begin(settingsStrings[spidev].c_str());
|
||||||
LoraSPI = &SPI;
|
|
||||||
DisplaySPI = &SPI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,5 +57,3 @@ enum { level_error, level_warn, level_info, level_debug };
|
|||||||
extern std::map<configNames, int> settingsMap;
|
extern std::map<configNames, int> settingsMap;
|
||||||
extern std::map<configNames, std::string> settingsStrings;
|
extern std::map<configNames, std::string> settingsStrings;
|
||||||
int initGPIOPin(int pinNum, std::string gpioChipname);
|
int initGPIOPin(int pinNum, std::string gpioChipname);
|
||||||
extern HardwareSPI *DisplaySPI;
|
|
||||||
extern HardwareSPI *LoraSPI;
|
|
@ -1,6 +1,6 @@
|
|||||||
[env:TWC_mesh_v4]
|
[env:TWC_mesh_v4]
|
||||||
extends = nrf52840_base
|
extends = nrf52840_base
|
||||||
board = TWC_mesh_v4
|
board = nordic_pca10059
|
||||||
board_level = extra
|
board_level = extra
|
||||||
build_flags = ${nrf52840_base.build_flags} -I variants/TWC_mesh_v4 -D TWC_mesh_v4 -L".pio\libdeps\TWC_mesh_v4\BSEC2 Software Library\src\cortex-m4\fpv4-sp-d16-hard"
|
build_flags = ${nrf52840_base.build_flags} -I variants/TWC_mesh_v4 -D TWC_mesh_v4 -L".pio\libdeps\TWC_mesh_v4\BSEC2 Software Library\src\cortex-m4\fpv4-sp-d16-hard"
|
||||||
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/TWC_mesh_v4>
|
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/TWC_mesh_v4>
|
||||||
|
@ -131,7 +131,7 @@ External serial flash WP25R1635FZUIL0
|
|||||||
// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching
|
// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching
|
||||||
#define SX1262_DIO3 \
|
#define SX1262_DIO3 \
|
||||||
(0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main
|
(0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main
|
||||||
// CPU?
|
// CPU?
|
||||||
#define SX126X_BUSY (0 + 17)
|
#define SX126X_BUSY (0 + 17)
|
||||||
#define SX126X_RESET (0 + 25)
|
#define SX126X_RESET (0 + 25)
|
||||||
// Not really an E22 but TTGO seems to be trying to clone that
|
// Not really an E22 but TTGO seems to be trying to clone that
|
||||||
@ -177,13 +177,13 @@ External serial flash WP25R1635FZUIL0
|
|||||||
#define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake
|
#define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake
|
||||||
// Seems to be missing on this new board
|
// Seems to be missing on this new board
|
||||||
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
||||||
#define PIN_GPS_TX (32 + 9) // This is for bits going TOWARDS the CPU
|
#define GPS_TX_PIN (32 + 9) // This is for bits going TOWARDS the CPU
|
||||||
#define PIN_GPS_RX (32 + 8) // This is for bits going TOWARDS the GPS
|
#define GPS_RX_PIN (32 + 8) // This is for bits going TOWARDS the GPS
|
||||||
|
|
||||||
#define GPS_THREAD_INTERVAL 50
|
#define GPS_THREAD_INTERVAL 50
|
||||||
|
|
||||||
#define PIN_SERIAL1_RX PIN_GPS_TX
|
#define PIN_SERIAL1_RX GPS_TX_PIN
|
||||||
#define PIN_SERIAL1_TX PIN_GPS_RX
|
#define PIN_SERIAL1_TX GPS_RX_PIN
|
||||||
|
|
||||||
// PCF8563 RTC Module
|
// PCF8563 RTC Module
|
||||||
#define PCF8563_RTC 0x51
|
#define PCF8563_RTC 0x51
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
extends = esp32s3_base
|
extends = esp32s3_base
|
||||||
board = tbeam-s3-core
|
board = tbeam-s3-core
|
||||||
|
|
||||||
|
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.15
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${esp32s3_base.lib_deps}
|
${esp32s3_base.lib_deps}
|
||||||
lewisxhe/PCF8563_Library@1.0.1
|
lewisxhe/PCF8563_Library@1.0.1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 2
|
major = 2
|
||||||
minor = 3
|
minor = 3
|
||||||
build = 8
|
build = 9
|
||||||
|
Loading…
Reference in New Issue
Block a user