Skip to content

Commit 27dc3be

Browse files
committed
Merge branch 'develop'
2 parents e1c259a + f2a63fa commit 27dc3be

File tree

12 files changed

+543
-64
lines changed

12 files changed

+543
-64
lines changed

src/graphics/SharedUIDisplay.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
#include "graphics/SharedUIDisplay.h"
1+
#include "configuration.h"
2+
#if HAS_SCREEN
23
#include "RTC.h"
34
#include "graphics/ScreenFonts.h"
5+
#include "graphics/SharedUIDisplay.h"
46
#include "graphics/draw/UIRenderer.h"
57
#include "main.h"
68
#include "meshtastic/config.pb.h"
@@ -423,3 +425,4 @@ std::string sanitizeString(const std::string &input)
423425
}
424426

425427
} // namespace graphics
428+
#endif

src/graphics/VirtualKeyboard.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#include "VirtualKeyboard.h"
21
#include "configuration.h"
2+
#if HAS_SCREEN
3+
#include "VirtualKeyboard.h"
34
#include "graphics/Screen.h"
45
#include "graphics/ScreenFonts.h"
56
#include "graphics/SharedUIDisplay.h"
@@ -736,3 +737,4 @@ bool VirtualKeyboard::isTimedOut() const
736737
}
737738

738739
} // namespace graphics
740+
#endif

src/graphics/draw/CompassRenderer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "configuration.h"
2+
#if HAS_SCREEN
13
#include "CompassRenderer.h"
24
#include "NodeDB.h"
35
#include "UIRenderer.h"
@@ -135,3 +137,4 @@ uint16_t getCompassDiam(uint32_t displayWidth, uint32_t displayHeight)
135137

136138
} // namespace CompassRenderer
137139
} // namespace graphics
140+
#endif

src/graphics/emotes.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "configuration.h"
2+
#if HAS_SCREEN
13
#include "emotes.h"
24

35
namespace graphics
@@ -275,3 +277,4 @@ const unsigned char bell_icon[] PROGMEM = {
275277
#endif
276278

277279
} // namespace graphics
280+
#endif

src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ void InkHUD::MenuApplet::drawSystemInfoPanel(int16_t left, int16_t top, uint16_t
709709
// Voltage
710710
float voltage = powerStatus->getBatteryVoltageMv() / 1000.0;
711711
char voltageStr[6]; // "XX.XV"
712-
sprintf(voltageStr, "%.1fV", voltage);
712+
sprintf(voltageStr, "%.2fV", voltage);
713713
printAt(colC[0], labelT, "Bat", CENTER, TOP);
714714
printAt(colC[0], valT, voltageStr, CENTER, TOP);
715715

src/mesh/PhoneAPI.cpp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ void PhoneAPI::handleStartConfig()
5757
#endif
5858
}
5959

60+
// Allow subclasses to prepare for high-throughput config traffic
61+
onConfigStart();
62+
6063
// even if we were already connected - restart our state machine
6164
if (config_nonce == SPECIAL_NONCE_ONLY_NODES) {
6265
// If client only wants node info, jump directly to sending nodes
@@ -71,7 +74,7 @@ void PhoneAPI::handleStartConfig()
7174
spiLock->unlock();
7275
LOG_DEBUG("Got %d files in manifest", filesManifest.size());
7376

74-
LOG_INFO("Start API client config");
77+
LOG_INFO("Start API client config millis=%u", millis());
7578
// Protect against concurrent BLE callbacks: they run in NimBLE's FreeRTOS task and also touch nodeInfoQueue.
7679
{
7780
concurrency::LockGuard guard(&nodeInfoMutex);
@@ -453,7 +456,10 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
453456
break;
454457

455458
case STATE_SEND_OTHER_NODEINFOS: {
456-
LOG_DEBUG("Send known nodes");
459+
if (readIndex == 2) { // readIndex==2 will be true for the first non-us node
460+
LOG_INFO("Start sending nodeinfos millis=%u", millis());
461+
}
462+
457463
meshtastic_NodeInfo infoToSend = {};
458464
{
459465
concurrency::LockGuard guard(&nodeInfoMutex);
@@ -470,13 +476,22 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
470476
if (infoToSend.num != 0) {
471477
// Just in case we stored a different user.id in the past, but should never happen going forward
472478
sprintf(infoToSend.user.id, "!%08x", infoToSend.num);
473-
LOG_DEBUG("nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s", infoToSend.num, infoToSend.last_heard,
474-
infoToSend.user.id, infoToSend.user.long_name);
479+
480+
// Logging this really slows down sending nodes on initial connection because the serial console is so slow, so only
481+
// uncomment if you really need to:
482+
// LOG_INFO("nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s", nodeInfoForPhone.num, nodeInfoForPhone.last_heard,
483+
// nodeInfoForPhone.user.id, nodeInfoForPhone.user.long_name);
484+
485+
// Occasional progress logging. (readIndex==2 will be true for the first non-us node)
486+
if (readIndex == 2 || readIndex % 20 == 0) {
487+
LOG_DEBUG("nodeinfo: %d/%d", readIndex, nodeDB->getNumMeshNodes());
488+
}
489+
475490
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_node_info_tag;
476491
fromRadioScratch.node_info = infoToSend;
477492
prefetchNodeInfos();
478493
} else {
479-
LOG_DEBUG("Done sending nodeinfo");
494+
LOG_DEBUG("Done sending %d of %d nodeinfos millis=%u", readIndex, nodeDB->getNumMeshNodes(), millis());
480495
concurrency::LockGuard guard(&nodeInfoMutex);
481496
nodeInfoQueue.clear();
482497
state = STATE_SEND_FILEMANIFEST;
@@ -558,11 +573,15 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
558573

559574
void PhoneAPI::sendConfigComplete()
560575
{
561-
LOG_INFO("Config Send Complete");
576+
LOG_INFO("Config Send Complete millis=%u", millis());
562577
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag;
563578
fromRadioScratch.config_complete_id = config_nonce;
564579
config_nonce = 0;
565580
state = STATE_SEND_PACKETS;
581+
582+
// Allow subclasses to know we've entered steady-state so they can lower power consumption
583+
onConfigComplete();
584+
566585
pauseBluetoothLogging = false;
567586
}
568587

src/mesh/PhoneAPI.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class PhoneAPI
136136
bool available();
137137

138138
bool isConnected() { return state != STATE_SEND_NOTHING; }
139+
bool isSendingPackets() { return state == STATE_SEND_PACKETS; }
139140

140141
protected:
141142
/// Our fromradio packet while it is being assembled
@@ -158,6 +159,11 @@ class PhoneAPI
158159
*/
159160
virtual void onNowHasData(uint32_t fromRadioNum) {}
160161

162+
/// Subclasses can use these lifecycle hooks for transport-specific behavior around config/steady-state
163+
/// (i.e. BLE connection params)
164+
virtual void onConfigStart() {}
165+
virtual void onConfigComplete() {}
166+
161167
/// begin a new connection
162168
void handleStartConfig();
163169

src/modules/Telemetry/EnvironmentTelemetry.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ bool EnvironmentTelemetryModule::wantUIFrame()
361361
return moduleConfig.telemetry.environment_screen_enabled;
362362
}
363363

364+
#if HAS_SCREEN
364365
void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
365366
{
366367
// === Setup display ===
@@ -510,6 +511,7 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt
510511
currentY += rowHeight;
511512
}
512513
}
514+
#endif
513515

514516
bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t)
515517
{

src/modules/Telemetry/PowerTelemetry.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ bool PowerTelemetryModule::wantUIFrame()
108108
return moduleConfig.telemetry.power_screen_enabled;
109109
}
110110

111+
#if HAS_SCREEN
111112
void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
112113
{
113114
display->clear();
@@ -165,6 +166,7 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s
165166
drawLine("Ch3", m.ch3_voltage, m.ch3_current);
166167
}
167168
}
169+
#endif
168170

169171
bool PowerTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t)
170172
{

0 commit comments

Comments
 (0)