mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 01:42:15 +00:00
Merge branch 'master' into gps-fixedposboot
This commit is contained in:
commit
9e8342eb8f
@ -1,9 +1,9 @@
|
||||
#include "OSThread.h"
|
||||
#include "configuration.h"
|
||||
#ifdef DEBUG_HEAP
|
||||
#ifdef HAS_SCREEN
|
||||
#include "graphics/Screen.h"
|
||||
#include "main.h"
|
||||
#endif
|
||||
#include "main.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace concurrency
|
||||
@ -83,18 +83,21 @@ void OSThread::run()
|
||||
#endif
|
||||
currentThread = this;
|
||||
auto newDelay = runOnce();
|
||||
#ifdef DEBUG_HEAP
|
||||
#ifdef ARCH_ESP32
|
||||
auto newHeap = ESP.getFreeHeap();
|
||||
if (newHeap < 10000) {
|
||||
LOG_DEBUG("\n\n====== heap too low [10000] -> reboot in 5s ======\n\n");
|
||||
#ifdef HAS_SCREEN
|
||||
screen->startRebootScreen();
|
||||
#endif
|
||||
rebootAtMsec = millis() + 5000;
|
||||
}
|
||||
#ifdef DEBUG_HEAP
|
||||
if (newHeap < heap)
|
||||
LOG_DEBUG("------ Thread %s leaked heap %d -> %d (%d) ------\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
if (heap < newHeap)
|
||||
LOG_DEBUG("++++++ Thread %s freed heap %d -> %d (%d) ++++++\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||
|
||||
if (newHeap < 10000) {
|
||||
LOG_DEBUG("\n\n====== heap too low [10000] -> reboot in 5s ======\n\n");
|
||||
screen->startRebootScreen();
|
||||
rebootAtMsec = millis() + 5000;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
runned();
|
||||
|
@ -12,7 +12,7 @@
|
||||
A simple interface to send messages over the mesh network by sending strings
|
||||
over a serial port.
|
||||
|
||||
Default is to use RX GPIO 16 and TX GPIO 17.
|
||||
There are no PIN defaults, you have to enable the second serial port yourself.
|
||||
|
||||
Need help with this module? Post your question on the Meshtastic Discourse:
|
||||
https://meshtastic.discourse.group
|
||||
@ -46,8 +46,6 @@
|
||||
|
||||
#if (defined(ARCH_ESP32) || defined(ARCH_NRF52)) && !defined(TTGO_T_ECHO) && !defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
|
||||
#define RXD2 16
|
||||
#define TXD2 17
|
||||
#define RX_BUFFER 128
|
||||
#define TIMEOUT 250
|
||||
#define BAUD 38400
|
||||
@ -102,7 +100,7 @@ int32_t SerialModule::runOnce()
|
||||
// moduleConfig.serial.timeout = 1000;
|
||||
// moduleConfig.serial.echo = 1;
|
||||
|
||||
if (moduleConfig.serial.enabled) {
|
||||
if (moduleConfig.serial.enabled && moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
||||
|
||||
if (firstTime) {
|
||||
|
||||
@ -165,9 +163,6 @@ int32_t SerialModule::runOnce()
|
||||
|
||||
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
||||
Serial2.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd);
|
||||
|
||||
} else {
|
||||
Serial2.begin(baud, SERIAL_8N1, RXD2, TXD2);
|
||||
}
|
||||
#else
|
||||
if (moduleConfig.serial.rxd && moduleConfig.serial.txd)
|
||||
|
@ -53,10 +53,8 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ptr = strtok(NULL, "/");
|
||||
}
|
||||
LOG_DEBUG("Looking for Channel name: %s\n", ptr);
|
||||
meshtastic_Channel sendChannel = channels.getByName(ptr);
|
||||
LOG_DEBUG("Found Channel name: %s (Index %d)\n", channels.getGlobalId(sendChannel.settings.channel_num),
|
||||
sendChannel.settings.channel_num);
|
||||
LOG_DEBUG("Found Channel name: %s (Index %d)\n", channels.getGlobalId(sendChannel.index), sendChannel.index);
|
||||
|
||||
if ((json.find("sender") != json.end()) && (json.find("payload") != json.end()) &&
|
||||
(json.find("type") != json.end()) && json["type"]->IsString() &&
|
||||
@ -70,7 +68,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
|
||||
// construct protobuf data packet using TEXT_MESSAGE, send it to the mesh
|
||||
meshtastic_MeshPacket *p = router->allocForSending();
|
||||
p->decoded.portnum = meshtastic_PortNum_TEXT_MESSAGE_APP;
|
||||
p->channel = sendChannel.settings.channel_num;
|
||||
p->channel = sendChannel.index;
|
||||
if (sendChannel.settings.downlink_enabled) {
|
||||
if (jsonPayloadStr.length() <= sizeof(p->decoded.payload.bytes)) {
|
||||
memcpy(p->decoded.payload.bytes, jsonPayloadStr.c_str(), jsonPayloadStr.length());
|
||||
@ -104,7 +102,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
|
||||
// construct protobuf data packet using POSITION, send it to the mesh
|
||||
meshtastic_MeshPacket *p = router->allocForSending();
|
||||
p->decoded.portnum = meshtastic_PortNum_POSITION_APP;
|
||||
p->channel = sendChannel.settings.channel_num;
|
||||
p->channel = sendChannel.index;
|
||||
if (sendChannel.settings.downlink_enabled) {
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes),
|
||||
|
Loading…
Reference in New Issue
Block a user