Fix a couple of warnings

pull/6445/head
Thomas Göttgens 2025-03-29 13:02:44 +01:00
rodzic ea9485657e
commit c2635df6b0
8 zmienionych plików z 24 dodań i 23 usunięć

Wyświetl plik

@ -533,6 +533,7 @@ Power::Power() : OSThread("Power")
{
statusHandler = {};
low_voltage_counter = 0;
low_voltage_counter_led3 = 0;
#ifdef DEBUG_HEAP
lastheap = memGet.getFreeHeap();
#endif
@ -668,12 +669,12 @@ void Power::readPowerStatus()
int8_t batteryChargePercent = -1;
OptionalBool usbPowered = OptUnknown;
OptionalBool hasBattery = OptUnknown; // These must be static because NRF_APM code doesn't run every time
OptionalBool isCharging = OptUnknown;
OptionalBool isChargingNow = OptUnknown;
if (batteryLevel) {
hasBattery = batteryLevel->isBatteryConnect() ? OptTrue : OptFalse;
usbPowered = batteryLevel->isVbusIn() ? OptTrue : OptFalse;
isCharging = batteryLevel->isCharging() ? OptTrue : OptFalse;
isChargingNow = batteryLevel->isCharging() ? OptTrue : OptFalse;
if (hasBattery) {
batteryVoltageMv = batteryLevel->getBattVoltage();
// If the AXP192 returns a valid battery percentage, use it
@ -702,15 +703,15 @@ void Power::readPowerStatus()
// If changed to DISCONNECTED
if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED)
isCharging = usbPowered = OptFalse;
isChargingNow = usbPowered = OptFalse;
// If changed to CONNECTED / READY
else
isCharging = usbPowered = OptTrue;
isChargingNow = usbPowered = OptTrue;
#endif
// Notify any status instances that are observing us
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent);
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isChargingNow, batteryVoltageMv, batteryChargePercent);
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(),
powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG)

Wyświetl plik

@ -981,15 +981,16 @@ void GPS::down()
setPowerState(GPS_IDLE);
else {
// Check whether the GPS hardware is capable of GPS_SOFTSLEEP
// If not, fallback to GPS_HARDSLEEP instead
// Check whether the GPS hardware is capable of GPS_SOFTSLEEP
// If not, fallback to GPS_HARDSLEEP instead
#ifdef PIN_GPS_STANDBY // L76B, L76K and clones have a standby pin
bool softsleepSupported = true;
#else
bool softsleepSupported = false;
#endif
// U-blox is supported via PMREQ
if (IS_ONE_OF(gnssModel, GNSS_MODEL_UBLOX6, GNSS_MODEL_UBLOX7, GNSS_MODEL_UBLOX8, GNSS_MODEL_UBLOX9, GNSS_MODEL_UBLOX10))
softsleepSupported = true;
#ifdef PIN_GPS_STANDBY // L76B, L76K and clones have a standby pin
softsleepSupported = true;
#endif
if (softsleepSupported) {
// How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than

Wyświetl plik

@ -1061,8 +1061,8 @@ void NodeDB::loadFromDisk()
// if (state != LoadFileResult::LOAD_SUCCESS) {
// installDefaultDeviceState(); // Our in RAM copy might now be corrupt
//} else {
if (devicestate.version < DEVICESTATE_MIN_VER) {
LOG_WARN("Devicestate %d is old, discard", devicestate.version);
if ((state != LoadFileResult::LOAD_SUCCESS) || (devicestate.version < DEVICESTATE_MIN_VER)) {
LOG_WARN("Devicestate %d is old or invalid, discard", devicestate.version);
installDefaultDeviceState();
} else {
LOG_INFO("Loaded saved devicestate version %d", devicestate.version);

Wyświetl plik

@ -188,7 +188,7 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src)
// don't override if a channel was requested and no need to set it when PKI is enforced
if (!p->channel && !p->pki_encrypted && !isBroadcast(p->to)) {
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->to);
meshtastic_NodeInfoLite const *node = nodeDB->getMeshNode(p->to);
if (node) {
p->channel = node->channel;
LOG_DEBUG("localSend to channel %d", p->channel);
@ -688,7 +688,7 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
return;
}
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->from);
meshtastic_NodeInfoLite const *node = nodeDB->getMeshNode(p->from);
if (node != NULL && node->is_ignored) {
LOG_DEBUG("Ignore msg, 0x%x is ignored", p->from);
packetPool.release(p);

Wyświetl plik

@ -37,7 +37,7 @@ class STM32_LittleFS
{
public:
STM32_LittleFS(void);
STM32_LittleFS(struct lfs_config *cfg);
explicit STM32_LittleFS(struct lfs_config *cfg);
virtual ~STM32_LittleFS();
bool begin(struct lfs_config *cfg = NULL);

Wyświetl plik

@ -217,9 +217,9 @@ int File::available(void)
_fs->_lockFS();
if (!this->_is_dir) {
uint32_t size = lfs_file_size(_fs->_getFS(), _file);
uint32_t file_size = lfs_file_size(_fs->_getFS(), _file);
uint32_t pos = lfs_file_tell(_fs->_getFS(), _file);
ret = size - pos;
ret = file_size - pos;
}
_fs->_unlockFS();
@ -279,10 +279,9 @@ bool File::truncate(uint32_t pos)
bool File::truncate(void)
{
int32_t ret = LFS_ERR_ISDIR;
uint32_t pos;
_fs->_lockFS();
if (!this->_is_dir) {
pos = lfs_file_tell(_fs->_getFS(), _file);
uint32_t pos = lfs_file_tell(_fs->_getFS(), _file);
ret = lfs_file_truncate(_fs->_getFS(), _file, pos);
}
_fs->_unlockFS();

Wyświetl plik

@ -42,7 +42,7 @@ enum {
class File : public Stream
{
public:
File(STM32_LittleFS &fs);
explicit File(STM32_LittleFS &fs);
File(char const *filename, uint8_t mode, STM32_LittleFS &fs);
public:

Wyświetl plik

@ -863,7 +863,7 @@ static int lfs_dir_find(lfs_t *lfs, lfs_dir_t *dir, lfs_entry_t *entry, const ch
// check that entry has not been moved
if (entry->d.type & 0x80) {
int moved = lfs_moved(lfs, &entry->d.u);
if (moved < 0 || moved) {
if (moved) {
return (moved < 0) ? moved : LFS_ERR_NOENT;
}
@ -1057,7 +1057,7 @@ int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off)
return 0;
}
lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir)
lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t const *dir)
{
(void)lfs;
return dir->pos;
@ -1755,7 +1755,7 @@ int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size)
return 0;
}
lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file)
lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t const *file)
{
(void)lfs;
return file->pos;