Skip to content

Commit 01dac23

Browse files
committed
fix(misc): Fix few compilation/check warnings
1 parent 28f53d1 commit 01dac23

File tree

14 files changed

+27
-56
lines changed

14 files changed

+27
-56
lines changed

src/Power.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
376376
// ADC2 wifi bug workaround not required, breaks compile
377377
// On ESP32S3, ADC2 can take turns with Wifi (?)
378378

379-
int32_t adc_buf;
379+
int adc_buf;
380380
esp_err_t read_result;
381381

382382
// Multiple samples
@@ -394,7 +394,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
394394
}
395395

396396
#else // Other ESP32
397-
int32_t adc_buf = 0;
397+
int adc_buf = 0;
398398
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
399399
// ADC2 wifi bug workaround, see
400400
// https://github.com/espressif/arduino-esp32/issues/102

src/gps/RTC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ time_t gm_mktime(struct tm *tm)
395395
days_before_this_year -= 719162; // (1969 * 365 + 1969 / 4 - 1969 / 100 + 1969 / 400);
396396

397397
// Now, within this tm->year, compute the days *before* this tm->month starts.
398-
int days_before_month[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; // non-leap year
398+
const int days_before_month[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; // non-leap year
399399
int days_this_year_before_this_month = days_before_month[tm->tm_mon]; // tm->tm_mon is 0..11
400400

401401
// If this is a leap year, and we're past February, add a day:

src/graphics/Screen.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,6 @@ static void drawModuleFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int
281281
pi.drawFrame(display, state, x, y);
282282
}
283283

284-
// Ignore messages originating from phone (from the current node 0x0) unless range test or store and forward module are enabled
285-
static bool shouldDrawMessage(const meshtastic_MeshPacket *packet)
286-
{
287-
return packet->from != 0 && !moduleConfig.store_forward.enabled;
288-
}
289-
290284
/**
291285
* Given a recent lat/lon return a guess of the heading the user is walking on.
292286
*
@@ -341,9 +335,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O
341335
uint8_t TFT_MESH_b = rawRGB & 0xFF;
342336
LOG_INFO("Values of r,g,b: %d, %d, %d", TFT_MESH_r, TFT_MESH_g, TFT_MESH_b);
343337

344-
if (TFT_MESH_r <= 255 && TFT_MESH_g <= 255 && TFT_MESH_b <= 255) {
345-
TFT_MESH = COLOR565(TFT_MESH_r, TFT_MESH_g, TFT_MESH_b);
346-
}
338+
TFT_MESH = COLOR565(TFT_MESH_r, TFT_MESH_g, TFT_MESH_b);
347339
}
348340

349341
#if defined(USE_SH1106) || defined(USE_SH1107) || defined(USE_SH1107_128_64)
@@ -813,6 +805,7 @@ int32_t Screen::runOnce()
813805
break;
814806
case Cmd::STOP_ALERT_FRAME:
815807
NotificationRenderer::pauseBanner = false;
808+
break;
816809
case Cmd::STOP_BOOT_SCREEN:
817810
EINK_ADD_FRAMEFLAG(dispdev, COSMETIC); // E-Ink: Explicitly use full-refresh for next frame
818811
if (NotificationRenderer::current_notification_type != notificationTypeEnum::text_input) {
@@ -822,7 +815,7 @@ int32_t Screen::runOnce()
822815
case Cmd::NOOP:
823816
break;
824817
default:
825-
LOG_ERROR("Invalid screen cmd");
818+
LOG_ERROR("Invalid screen cmd %d", static_cast<int>(cmd.cmd));
826819
}
827820
}
828821

@@ -983,9 +976,6 @@ void Screen::setFrames(FrameFocus focus)
983976
}
984977
#endif
985978

986-
// Declare this early so it’s available in FOCUS_PRESERVE block
987-
bool willInsertTextMessage = shouldDrawMessage(&devicestate.rx_text_message);
988-
989979
if (!hiddenFrames.home) {
990980
fsi.positions.home = numframes;
991981
normalFrames[numframes++] = graphics::UIRenderer::drawDeviceFocused;

src/graphics/SharedUIDisplay.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *ti
117117
// plugged in
118118
}
119119

120-
uint32_t now = millis();
121-
122120
#ifndef USE_EINK
123121
if (isCharging && now - lastBlinkShared > 500) {
124122
isBoltVisibleShared = !isBoltVisibleShared;

src/graphics/VirtualKeyboard.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,6 @@ void VirtualKeyboard::drawInputArea(OLEDDisplay *display, int16_t offsetX, int16
354354
if (screenHeight <= 64) {
355355
textY = boxY + (boxHeight - inputLineH) / 2;
356356
} else {
357-
const int innerLeft = boxX + 1;
358-
const int innerRight = boxX + boxWidth - 2;
359357
const int innerTop = boxY + 1;
360358
const int innerBottom = boxY + boxHeight - 2;
361359

src/graphics/draw/ClockRenderer.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int1
192192
const char *titleStr = "";
193193
// === Header ===
194194
graphics::drawCommonHeader(display, x, y, titleStr, true, true);
195-
int line = 0;
196195

197196
#ifdef T_WATCH_S3
198197
if (nimbleBluetooth && nimbleBluetooth->isConnected()) {
@@ -317,7 +316,6 @@ void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
317316
const char *titleStr = "";
318317
// === Header ===
319318
graphics::drawCommonHeader(display, x, y, titleStr, true, true);
320-
int line = 0;
321319

322320
#ifdef T_WATCH_S3
323321
if (nimbleBluetooth && nimbleBluetooth->isConnected()) {
@@ -413,17 +411,12 @@ void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
413411
double minuteAngleOffset = ((double)second / 60) * degreesPerMinuteOrSecond;
414412
double minuteAngle = radians(minuteBaseAngle + minuteAngleOffset);
415413

416-
double secondAngle = radians(second * degreesPerMinuteOrSecond);
417-
418414
double hourX = sin(-hourAngle) * (hourHandNoonY - centerY) + noonX;
419415
double hourY = cos(-hourAngle) * (hourHandNoonY - centerY) + centerY;
420416

421417
double minuteX = sin(-minuteAngle) * (minuteHandNoonY - centerY) + noonX;
422418
double minuteY = cos(-minuteAngle) * (minuteHandNoonY - centerY) + centerY;
423419

424-
double secondX = sin(-secondAngle) * (secondHandNoonY - centerY) + noonX;
425-
double secondY = cos(-secondAngle) * (secondHandNoonY - centerY) + centerY;
426-
427420
display->setFont(FONT_MEDIUM);
428421

429422
// draw minute and hour tick marks and hour numbers

src/graphics/draw/NodeListRenderer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,12 @@ void drawCompassArrow(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16
362362
float bearing = GeoCoord::bearing(userLat, userLon, nodeLat, nodeLon);
363363
float bearingToNode = RAD_TO_DEG * bearing;
364364
float relativeBearing = fmod((bearingToNode - myHeading + 360), 360);
365-
float angle = relativeBearing * DEG_TO_RAD;
365+
366366
// Shrink size by 2px
367367
int size = FONT_HEIGHT_SMALL - 5;
368368
CompassRenderer::drawArrowToNode(display, centerX, centerY, size, relativeBearing);
369369
/*
370+
float angle = relativeBearing * DEG_TO_RAD;
370371
float halfSize = size / 2.0;
371372
372373
// Point of the arrow

src/graphics/draw/UIRenderer.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,6 @@ void UIRenderer::drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayU
998998
config.display.heading_bold = false;
999999

10001000
const char *displayLine = ""; // Initialize to empty string by default
1001-
meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum());
10021001

10031002
if (config.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
10041003
if (config.position.fixed_position) {
@@ -1050,7 +1049,6 @@ void UIRenderer::drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayU
10501049
uint32_t days = delta / 86400;
10511050
uint32_t hours = (delta % 86400) / 3600;
10521051
uint32_t mins = (delta % 3600) / 60;
1053-
uint32_t secs = delta % 60;
10541052

10551053
char buf[32];
10561054
#if defined(USE_EINK)
@@ -1063,6 +1061,7 @@ void UIRenderer::drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayU
10631061
snprintf(buf, sizeof(buf), "Last: %um", mins);
10641062
}
10651063
#else
1064+
uint32_t secs = delta % 60;
10661065
// Non E-Ink: include seconds where useful
10671066
if (days > 0) {
10681067
snprintf(buf, sizeof(buf), "Last: %ud %uh", days, hours);
@@ -1140,13 +1139,13 @@ void UIRenderer::drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayU
11401139
// Portrait or square: put compass at the bottom and centered, scaled to fit available space
11411140
// For E-Ink screens, account for navigation bar at the bottom!
11421141
int yBelowContent = getTextPositions(display)[5] + FONT_HEIGHT_SMALL + 2;
1143-
const int margin = 4;
1144-
int availableHeight =
1142+
11451143
#if defined(USE_EINK)
1146-
SCREEN_HEIGHT - yBelowContent - 24; // Leave extra space for nav bar on E-Ink
1144+
const int margin = 24; // Leave extra space for nav bar on E-Ink
11471145
#else
1148-
SCREEN_HEIGHT - yBelowContent - margin;
1146+
const int margin = 4;
11491147
#endif
1148+
int availableHeight = SCREEN_HEIGHT - yBelowContent - margin;
11501149

11511150
if (availableHeight < FONT_HEIGHT_SMALL * 2)
11521151
return;

src/main.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,3 @@ meshtastic_DeviceMetadata getDeviceMetadata();
9797
void scannerToSensorsMap(const std::unique_ptr<ScanI2CTwoWire> &i2cScanner, ScanI2C::DeviceType deviceType,
9898
meshtastic_TelemetrySensorType sensorType);
9999
#endif
100-
101-
// We default to 4MHz SPI, SPI mode 0
102-
extern SPISettings spiSettings;

src/modules/ExternalNotificationModule.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@ int32_t ExternalNotificationModule::runOnce()
8989
return INT32_MAX; // we don't need this thread here...
9090
} else {
9191
uint32_t delay = EXT_NOTIFICATION_MODULE_OUTPUT_MS;
92-
bool isRtttlPlaying = rtttl::isPlaying();
93-
#ifdef HAS_I2S
94-
// audioThread->isPlaying() also handles actually playing the RTTTL, needs to be called in loop
95-
isRtttlPlaying = isRtttlPlaying || audioThread->isPlaying();
96-
#endif
92+
9793
if ((nagCycleCutoff <= millis())) {
9894
// Turn off external notification immediately when timeout is reached, regardless of song state
9995
nagCycleCutoff = UINT32_MAX;

0 commit comments

Comments
 (0)