mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-13 22:32:27 +00:00
Merge branch 'develop' into multi-message-Storage
This commit is contained in:
@@ -50,6 +50,7 @@ void consolePrintf(const char *format, ...)
|
||||
|
||||
SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port), concurrency::OSThread("SerialConsole")
|
||||
{
|
||||
api_type = TYPE_SERIAL;
|
||||
assert(!console);
|
||||
console = this;
|
||||
canWrite = false; // We don't send packets to our port until it has talked to us first
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "configuration.h"
|
||||
#if HAS_SCREEN
|
||||
#include "MeshService.h"
|
||||
#include "RTC.h"
|
||||
#include "draw/NodeListRenderer.h"
|
||||
#include "graphics/ScreenFonts.h"
|
||||
#include "graphics/SharedUIDisplay.h"
|
||||
#include "graphics/draw/UIRenderer.h"
|
||||
@@ -411,6 +413,43 @@ const int *getTextPositions(OLEDDisplay *display)
|
||||
return textPositions;
|
||||
}
|
||||
|
||||
// *************************
|
||||
// * Common Footer Drawing *
|
||||
// *************************
|
||||
void drawCommonFooter(OLEDDisplay *display, int16_t x, int16_t y)
|
||||
{
|
||||
bool drawConnectionState = false;
|
||||
if (service->api_state == service->STATE_BLE || service->api_state == service->STATE_WIFI ||
|
||||
service->api_state == service->STATE_SERIAL || service->api_state == service->STATE_PACKET ||
|
||||
service->api_state == service->STATE_HTTP || service->api_state == service->STATE_ETH) {
|
||||
drawConnectionState = true;
|
||||
}
|
||||
|
||||
if (drawConnectionState) {
|
||||
if (isHighResolution) {
|
||||
const int scale = 2;
|
||||
const int bytesPerRow = (connection_icon_width + 7) / 8;
|
||||
int iconX = 0;
|
||||
int iconY = SCREEN_HEIGHT - (connection_icon_height * 2);
|
||||
|
||||
for (int yy = 0; yy < connection_icon_height; ++yy) {
|
||||
const uint8_t *rowPtr = connection_icon + yy * bytesPerRow;
|
||||
for (int xx = 0; xx < connection_icon_width; ++xx) {
|
||||
const uint8_t byteVal = pgm_read_byte(rowPtr + (xx >> 3));
|
||||
const uint8_t bitMask = 1U << (xx & 7); // XBM is LSB-first
|
||||
if (byteVal & bitMask) {
|
||||
display->fillRect(iconX + xx * scale, iconY + yy * scale, scale, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
display->drawXbm(0, SCREEN_HEIGHT - connection_icon_height, connection_icon_width, connection_icon_height,
|
||||
connection_icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isAllowedPunctuation(char c)
|
||||
{
|
||||
const std::string allowed = ".,!?;:-_()[]{}'\"@#$/\\&+=%~^ ";
|
||||
|
||||
@@ -54,6 +54,9 @@ void drawRoundedHighlight(OLEDDisplay *display, int16_t x, int16_t y, int16_t w,
|
||||
void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *titleStr = "", bool force_no_invert = false,
|
||||
bool show_date = false);
|
||||
|
||||
// Shared battery/time/mail header
|
||||
void drawCommonFooter(OLEDDisplay *display, int16_t x, int16_t y);
|
||||
|
||||
const int *getTextPositions(OLEDDisplay *display);
|
||||
|
||||
bool isAllowedPunctuation(char c);
|
||||
|
||||
@@ -247,6 +247,8 @@ void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int1
|
||||
display->drawString(startingHourMinuteTextX + timeStringWidth - xOffset, (display->getHeight() - hourMinuteTextY) - yOffset,
|
||||
secondString);
|
||||
#endif
|
||||
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
void drawBluetoothConnectedIcon(OLEDDisplay *display, int16_t x, int16_t y)
|
||||
@@ -440,6 +442,7 @@ void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
||||
display->drawLine(centerX, centerY, secondX, secondY);
|
||||
#endif
|
||||
}
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
} // namespace ClockRenderer
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "../Screen.h"
|
||||
#include "DebugRenderer.h"
|
||||
#include "FSCommon.h"
|
||||
#include "MeshService.h"
|
||||
#include "NodeDB.h"
|
||||
#include "Throttle.h"
|
||||
#include "UIRenderer.h"
|
||||
@@ -223,6 +224,8 @@ void drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, i
|
||||
|
||||
display->drawString(x, getTextPositions(display)[line++], "URL: http://meshtastic.local");
|
||||
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
|
||||
/* Display a heartbeat pixel that blinks every time the frame is redrawn */
|
||||
#ifdef SHOW_REDRAWS
|
||||
if (heartbeat)
|
||||
@@ -502,6 +505,7 @@ void drawLoRaFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x,
|
||||
display->drawString(starting_position + chUtil_x + chutil_bar_width + extraoffset, getTextPositions(display)[line++],
|
||||
chUtilPercentage);
|
||||
#endif
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
// ****************************
|
||||
@@ -641,10 +645,9 @@ void drawSystemScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x
|
||||
int textWidth = display->getStringWidth(appversionstr);
|
||||
int nameX = (SCREEN_WIDTH - textWidth) / 2;
|
||||
|
||||
display->drawString(nameX, getTextPositions(display)[line], appversionstr);
|
||||
#if !defined(M5STACK_UNITC6L)
|
||||
if (SCREEN_HEIGHT > 64 || (SCREEN_HEIGHT <= 64 && line < 4)) { // Only show uptime if the screen can show it
|
||||
line += 1;
|
||||
display->drawString(nameX, getTextPositions(display)[line++], appversionstr);
|
||||
|
||||
if (SCREEN_HEIGHT > 64 || (SCREEN_HEIGHT <= 64 && line <= 5)) { // Only show uptime if the screen can show it
|
||||
char uptimeStr[32] = "";
|
||||
uint32_t uptime = millis() / 1000;
|
||||
uint32_t days = uptime / 86400;
|
||||
@@ -659,9 +662,41 @@ void drawSystemScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x
|
||||
snprintf(uptimeStr, sizeof(uptimeStr), " Uptime: %um", mins);
|
||||
textWidth = display->getStringWidth(uptimeStr);
|
||||
nameX = (SCREEN_WIDTH - textWidth) / 2;
|
||||
display->drawString(nameX, getTextPositions(display)[line], uptimeStr);
|
||||
display->drawString(nameX, getTextPositions(display)[line++], uptimeStr);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (SCREEN_HEIGHT > 64 || (SCREEN_HEIGHT <= 64 && line <= 5)) { // Only show API state if the screen can show it
|
||||
char api_state[32] = "";
|
||||
const char *clientWord = nullptr;
|
||||
|
||||
// Determine if narrow or wide screen
|
||||
if (isHighResolution) {
|
||||
clientWord = "Client";
|
||||
} else {
|
||||
clientWord = "App";
|
||||
}
|
||||
snprintf(api_state, sizeof(api_state), "No %ss Connected", clientWord);
|
||||
|
||||
if (service->api_state == service->STATE_BLE) {
|
||||
snprintf(api_state, sizeof(api_state), "%s Connected (BLE)", clientWord);
|
||||
} else if (service->api_state == service->STATE_WIFI) {
|
||||
snprintf(api_state, sizeof(api_state), "%s Connected (WiFi)", clientWord);
|
||||
} else if (service->api_state == service->STATE_SERIAL) {
|
||||
snprintf(api_state, sizeof(api_state), "%s Connected (Serial)", clientWord);
|
||||
} else if (service->api_state == service->STATE_PACKET) {
|
||||
snprintf(api_state, sizeof(api_state), "%s Connected (Internal)", clientWord);
|
||||
} else if (service->api_state == service->STATE_HTTP) {
|
||||
snprintf(api_state, sizeof(api_state), "%s Connected (HTTP)", clientWord);
|
||||
} else if (service->api_state == service->STATE_ETH) {
|
||||
snprintf(api_state, sizeof(api_state), "%s Connected (Ethernet)", clientWord);
|
||||
}
|
||||
if (api_state[0] != '\0') {
|
||||
display->drawString((SCREEN_WIDTH - display->getStringWidth(api_state)) / 2, getTextPositions(display)[line++],
|
||||
api_state);
|
||||
}
|
||||
}
|
||||
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
// ****************************
|
||||
|
||||
@@ -440,6 +440,8 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
||||
const char *messageString = "No messages";
|
||||
int center_text = (SCREEN_WIDTH / 2) - (display->getStringWidth(messageString) / 2);
|
||||
display->drawString(center_text, getTextPositions(display)[2], messageString);
|
||||
#endif
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -669,6 +671,8 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
||||
}
|
||||
|
||||
graphics::drawCommonHeader(display, x, y, titleStr);
|
||||
#endif
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
std::vector<std::string> generateLines(OLEDDisplay *display, const char *headerStr, const char *messageBuf, int textWidth)
|
||||
|
||||
@@ -508,6 +508,7 @@ void drawNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t
|
||||
#endif
|
||||
const int scrollStartY = y + 3;
|
||||
drawScrollbar(display, visibleNodeRows, totalEntries, scrollIndex, 2, scrollStartY);
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
// =============================
|
||||
|
||||
@@ -559,6 +559,7 @@ void UIRenderer::drawNodeInfo(OLEDDisplay *display, const OLEDDisplayUiState *st
|
||||
// else show nothing
|
||||
}
|
||||
#endif
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
// ****************************
|
||||
@@ -771,6 +772,7 @@ void UIRenderer::drawDeviceFocused(OLEDDisplay *display, OLEDDisplayUiState *sta
|
||||
display->drawString(nameX, getTextPositions(display)[line++], shortnameble);
|
||||
}
|
||||
#endif
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
// Start Functions to write date/time to the screen
|
||||
@@ -1176,6 +1178,7 @@ void UIRenderer::drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayU
|
||||
}
|
||||
#endif
|
||||
#endif // HAS_GPS
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
|
||||
#ifdef USERPREFS_OEM_TEXT
|
||||
@@ -1260,7 +1263,13 @@ void UIRenderer::drawNavigationBar(OLEDDisplay *display, OLEDDisplayUiState *sta
|
||||
if (totalIcons == 0)
|
||||
return;
|
||||
|
||||
const size_t iconsPerPage = (SCREEN_WIDTH + spacing) / (iconSize + spacing);
|
||||
const int navPadding = isHighResolution ? 24 : 12; // padding per side
|
||||
|
||||
int usableWidth = SCREEN_WIDTH - (navPadding * 2);
|
||||
if (usableWidth < iconSize)
|
||||
usableWidth = iconSize;
|
||||
|
||||
const size_t iconsPerPage = usableWidth / (iconSize + spacing);
|
||||
const size_t currentPage = currentFrame / iconsPerPage;
|
||||
const size_t pageStart = currentPage * iconsPerPage;
|
||||
const size_t pageEnd = min(pageStart + iconsPerPage, totalIcons);
|
||||
@@ -1331,6 +1340,47 @@ void UIRenderer::drawNavigationBar(OLEDDisplay *display, OLEDDisplayUiState *sta
|
||||
display->setColor(WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
// Compact arrow drawer
|
||||
auto drawArrow = [&](bool rightSide) {
|
||||
display->setColor(WHITE);
|
||||
|
||||
const int offset = isHighResolution ? 3 : 1;
|
||||
const int halfH = rectHeight / 2;
|
||||
|
||||
const int top = (y - 2) + (rectHeight - halfH) / 2;
|
||||
const int bottom = top + halfH - 1;
|
||||
const int midY = top + (halfH / 2);
|
||||
|
||||
const int maxW = 4;
|
||||
|
||||
// Determine left X coordinate
|
||||
int baseX = rightSide ? (rectX + rectWidth + offset) : // right arrow
|
||||
(rectX - offset - 1); // left arrow
|
||||
|
||||
for (int yy = top; yy <= bottom; yy++) {
|
||||
int dist = abs(yy - midY);
|
||||
int lineW = maxW - (dist * maxW / (halfH / 2));
|
||||
if (lineW < 1)
|
||||
lineW = 1;
|
||||
|
||||
if (rightSide) {
|
||||
display->drawHorizontalLine(baseX, yy, lineW);
|
||||
} else {
|
||||
display->drawHorizontalLine(baseX - lineW + 1, yy, lineW);
|
||||
}
|
||||
}
|
||||
};
|
||||
// Right arrow
|
||||
if (pageEnd < totalIcons) {
|
||||
drawArrow(true);
|
||||
}
|
||||
|
||||
// Left arrow
|
||||
if (pageStart > 0) {
|
||||
drawArrow(false);
|
||||
}
|
||||
|
||||
// Knock the corners off the square
|
||||
display->setColor(BLACK);
|
||||
display->drawRect(rectX, y - 2, 1, 1);
|
||||
|
||||
@@ -308,6 +308,10 @@ const uint8_t chirpy[] = {
|
||||
#define chirpy_small_image_height 8
|
||||
const uint8_t chirpy_small[] = {0x7f, 0x41, 0x55, 0x55, 0x55, 0x55, 0x41, 0x7f};
|
||||
|
||||
#define connection_icon_width 7
|
||||
#define connection_icon_height 5
|
||||
const uint8_t connection_icon[] = {0x36, 0x41, 0x5D, 0x41, 0x36};
|
||||
|
||||
#ifdef M5STACK_UNITC6L
|
||||
#include "img/icon_small.xbm"
|
||||
#else
|
||||
|
||||
@@ -79,6 +79,18 @@ class MeshService
|
||||
uint32_t oldFromNum = 0;
|
||||
|
||||
public:
|
||||
enum APIState {
|
||||
STATE_DISCONNECTED, // Initial state, no API is connected
|
||||
STATE_BLE,
|
||||
STATE_WIFI,
|
||||
STATE_SERIAL,
|
||||
STATE_PACKET,
|
||||
STATE_HTTP,
|
||||
STATE_ETH
|
||||
};
|
||||
|
||||
APIState api_state = STATE_DISCONNECTED;
|
||||
|
||||
static bool isTextPayload(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (moduleConfig.range_test.enabled && p->decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP) {
|
||||
|
||||
@@ -984,12 +984,25 @@ void NodeDB::installDefaultChannels()
|
||||
channelFile.version = DEVICESTATE_CUR_VER;
|
||||
}
|
||||
|
||||
void NodeDB::resetNodes()
|
||||
void NodeDB::resetNodes(bool keepFavorites)
|
||||
{
|
||||
if (!config.position.fixed_position)
|
||||
clearLocalPosition();
|
||||
numMeshNodes = 1;
|
||||
std::fill(nodeDatabase.nodes.begin() + 1, nodeDatabase.nodes.end(), meshtastic_NodeInfoLite());
|
||||
if (keepFavorites) {
|
||||
LOG_INFO("Clearing node database - preserving favorites");
|
||||
for (size_t i = 0; i < meshNodes->size(); i++) {
|
||||
meshtastic_NodeInfoLite &node = meshNodes->at(i);
|
||||
if (i > 0 && !node.is_favorite) {
|
||||
node = meshtastic_NodeInfoLite();
|
||||
} else {
|
||||
numMeshNodes += 1;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
LOG_INFO("Clearing node database - removing favorites");
|
||||
std::fill(nodeDatabase.nodes.begin() + 1, nodeDatabase.nodes.end(), meshtastic_NodeInfoLite());
|
||||
}
|
||||
devicestate.has_rx_text_message = false;
|
||||
devicestate.has_rx_waypoint = false;
|
||||
saveNodeDatabaseToDisk();
|
||||
|
||||
@@ -229,7 +229,8 @@ class NodeDB
|
||||
*/
|
||||
size_t getNumOnlineMeshNodes(bool localOnly = false);
|
||||
|
||||
void initConfigIntervals(), initModuleConfigIntervals(), resetNodes(), removeNodeByNum(NodeNum nodeNum);
|
||||
void initConfigIntervals(), initModuleConfigIntervals(), resetNodes(bool keepFavorites = false),
|
||||
removeNodeByNum(NodeNum nodeNum);
|
||||
|
||||
bool factoryReset(bool eraseBleBonds = false);
|
||||
|
||||
|
||||
@@ -87,6 +87,18 @@ void PhoneAPI::handleStartConfig()
|
||||
void PhoneAPI::close()
|
||||
{
|
||||
LOG_DEBUG("PhoneAPI::close()");
|
||||
if (service->api_state == service->STATE_BLE && api_type == TYPE_BLE)
|
||||
service->api_state = service->STATE_DISCONNECTED;
|
||||
else if (service->api_state == service->STATE_WIFI && api_type == TYPE_WIFI)
|
||||
service->api_state = service->STATE_DISCONNECTED;
|
||||
else if (service->api_state == service->STATE_SERIAL && api_type == TYPE_SERIAL)
|
||||
service->api_state = service->STATE_DISCONNECTED;
|
||||
else if (service->api_state == service->STATE_PACKET && api_type == TYPE_PACKET)
|
||||
service->api_state = service->STATE_DISCONNECTED;
|
||||
else if (service->api_state == service->STATE_HTTP && api_type == TYPE_HTTP)
|
||||
service->api_state = service->STATE_DISCONNECTED;
|
||||
else if (service->api_state == service->STATE_ETH && api_type == TYPE_ETH)
|
||||
service->api_state = service->STATE_DISCONNECTED;
|
||||
|
||||
if (state != STATE_SEND_NOTHING) {
|
||||
state = STATE_SEND_NOTHING;
|
||||
@@ -578,6 +590,19 @@ void PhoneAPI::sendConfigComplete()
|
||||
fromRadioScratch.config_complete_id = config_nonce;
|
||||
config_nonce = 0;
|
||||
state = STATE_SEND_PACKETS;
|
||||
if (api_type == TYPE_BLE) {
|
||||
service->api_state = service->STATE_BLE;
|
||||
} else if (api_type == TYPE_WIFI) {
|
||||
service->api_state = service->STATE_WIFI;
|
||||
} else if (api_type == TYPE_SERIAL) {
|
||||
service->api_state = service->STATE_SERIAL;
|
||||
} else if (api_type == TYPE_PACKET) {
|
||||
service->api_state = service->STATE_PACKET;
|
||||
} else if (api_type == TYPE_HTTP) {
|
||||
service->api_state = service->STATE_HTTP;
|
||||
} else if (api_type == TYPE_ETH) {
|
||||
service->api_state = service->STATE_ETH;
|
||||
}
|
||||
|
||||
// Allow subclasses to know we've entered steady-state so they can lower power consumption
|
||||
onConfigComplete();
|
||||
|
||||
@@ -167,6 +167,18 @@ class PhoneAPI
|
||||
/// begin a new connection
|
||||
void handleStartConfig();
|
||||
|
||||
enum APIType {
|
||||
TYPE_NONE, // Initial state, don't send anything until the client starts asking for config
|
||||
TYPE_BLE,
|
||||
TYPE_WIFI,
|
||||
TYPE_SERIAL,
|
||||
TYPE_PACKET,
|
||||
TYPE_HTTP,
|
||||
TYPE_ETH
|
||||
};
|
||||
|
||||
APIType api_type = TYPE_NONE;
|
||||
|
||||
private:
|
||||
void releasePhonePacket();
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ PacketAPI *PacketAPI::create(PacketServer *_server)
|
||||
PacketAPI::PacketAPI(PacketServer *_server)
|
||||
: concurrency::OSThread("PacketAPI"), isConnected(false), programmingMode(false), server(_server)
|
||||
{
|
||||
api_type = TYPE_PACKET;
|
||||
}
|
||||
|
||||
int32_t PacketAPI::runOnce()
|
||||
|
||||
@@ -25,6 +25,7 @@ void deInitApiServer()
|
||||
|
||||
WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : ServerAPI(_client)
|
||||
{
|
||||
api_type = TYPE_WIFI;
|
||||
LOG_INFO("Incoming wifi connection");
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ void initApiServer(int port)
|
||||
ethServerAPI::ethServerAPI(EthernetClient &_client) : ServerAPI(_client)
|
||||
{
|
||||
LOG_INFO("Incoming ethernet connection");
|
||||
api_type = TYPE_ETH;
|
||||
}
|
||||
|
||||
ethServerPort::ethServerPort(int port) : APIServerPort(port) {}
|
||||
|
||||
@@ -26,7 +26,7 @@ class HttpAPI : public PhoneAPI
|
||||
{
|
||||
|
||||
public:
|
||||
// Nothing here yet
|
||||
HttpAPI() { api_type = TYPE_HTTP; }
|
||||
|
||||
private:
|
||||
// Nothing here yet
|
||||
|
||||
@@ -27,7 +27,7 @@ class HttpAPI : public PhoneAPI
|
||||
{
|
||||
|
||||
public:
|
||||
// Nothing here yet
|
||||
HttpAPI() { api_type = TYPE_HTTP; }
|
||||
|
||||
private:
|
||||
// Nothing here yet
|
||||
|
||||
@@ -289,7 +289,12 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
||||
case meshtastic_AdminMessage_nodedb_reset_tag: {
|
||||
disableBluetooth();
|
||||
LOG_INFO("Initiate node-db reset");
|
||||
nodeDB->resetNodes();
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -65,13 +65,22 @@ SerialModuleRadio *serialModuleRadio;
|
||||
|
||||
#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) || \
|
||||
defined(ELECROW_ThinkNode_M5) || defined(HELTEC_MESH_SOLAR) || defined(T_ECHO_LITE)
|
||||
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial") {}
|
||||
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial")
|
||||
{
|
||||
api_type = TYPE_SERIAL;
|
||||
}
|
||||
static Print *serialPrint = &Serial;
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6) || defined(RAK3172) || defined(EBYTE_E77_MBL)
|
||||
SerialModule::SerialModule() : StreamAPI(&Serial1), concurrency::OSThread("Serial") {}
|
||||
SerialModule::SerialModule() : StreamAPI(&Serial1), concurrency::OSThread("Serial")
|
||||
{
|
||||
api_type = TYPE_SERIAL;
|
||||
}
|
||||
static Print *serialPrint = &Serial1;
|
||||
#else
|
||||
SerialModule::SerialModule() : StreamAPI(&Serial2), concurrency::OSThread("Serial") {}
|
||||
SerialModule::SerialModule() : StreamAPI(&Serial2), concurrency::OSThread("Serial")
|
||||
{
|
||||
api_type = TYPE_SERIAL;
|
||||
}
|
||||
static Print *serialPrint = &Serial2;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -517,6 +517,7 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt
|
||||
|
||||
currentY += rowHeight;
|
||||
}
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s
|
||||
if (m.has_ch3_voltage || m.has_ch3_current) {
|
||||
drawLine("Ch3", m.ch3_voltage, m.ch3_current);
|
||||
}
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ void PaxcounterModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
||||
display->drawStringf(display->getWidth() / 2 + x, graphics::getTextPositions(display)[line++], buffer,
|
||||
"WiFi: %d\nBLE: %d\nUptime: %ds", count_from_libpax.wifi_count, count_from_libpax.ble_count,
|
||||
millis() / 1000);
|
||||
graphics::drawCommonFooter(display, x, y);
|
||||
}
|
||||
#endif // HAS_SCREEN
|
||||
|
||||
|
||||
@@ -59,7 +59,13 @@ inline void onReceiveProto(char *topic, byte *payload, size_t length)
|
||||
LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!", topic, length);
|
||||
return;
|
||||
}
|
||||
|
||||
const meshtastic_Channel &ch = channels.getByName(e.channel_id);
|
||||
// Find channel by channel_id and check downlink_enabled
|
||||
if (!(strcmp(e.channel_id, "PKI") == 0 ||
|
||||
(strcmp(e.channel_id, channels.getGlobalId(ch.index)) == 0 && ch.settings.downlink_enabled))) {
|
||||
return;
|
||||
}
|
||||
// Generate node ID from nodenum for comparison
|
||||
std::string nodeId = nodeDB->getNodeId();
|
||||
if (strcmp(e.gateway_id, nodeId.c_str()) == 0) {
|
||||
@@ -77,11 +83,6 @@ inline void onReceiveProto(char *topic, byte *payload, size_t length)
|
||||
return;
|
||||
}
|
||||
|
||||
// Find channel by channel_id and check downlink_enabled
|
||||
if (!(strcmp(e.channel_id, "PKI") == 0 ||
|
||||
(strcmp(e.channel_id, channels.getGlobalId(ch.index)) == 0 && ch.settings.downlink_enabled))) {
|
||||
return;
|
||||
}
|
||||
LOG_INFO("Received MQTT topic %s, len=%u", topic, length);
|
||||
if (e.packet->hop_limit > HOP_MAX || e.packet->hop_start > HOP_MAX) {
|
||||
LOG_INFO("Invalid hop_limit(%u) or hop_start(%u)", e.packet->hop_limit, e.packet->hop_start);
|
||||
|
||||
@@ -118,7 +118,7 @@ class BluetoothPhoneAPI : public PhoneAPI, public concurrency::OSThread
|
||||
*/
|
||||
|
||||
public:
|
||||
BluetoothPhoneAPI() : concurrency::OSThread("NimbleBluetooth") {}
|
||||
BluetoothPhoneAPI() : concurrency::OSThread("NimbleBluetooth") { api_type = TYPE_BLE; }
|
||||
|
||||
/* Packets from phone (BLE onWrite callback) */
|
||||
std::mutex fromPhoneMutex;
|
||||
|
||||
@@ -48,6 +48,9 @@ class BluetoothPhoneAPI : public PhoneAPI
|
||||
|
||||
/// Check the current underlying physical link to see if the client is currently connected
|
||||
virtual bool checkIsConnected() override { return Bluefruit.connected(connectionHandle); }
|
||||
|
||||
public:
|
||||
BluetoothPhoneAPI() { api_type = TYPE_BLE; }
|
||||
};
|
||||
|
||||
static BluetoothPhoneAPI *bluetoothPhoneAPI;
|
||||
|
||||
Reference in New Issue
Block a user