* Log cleanups

change log levels, shorten log messages, delete commented out logs

* Address comments from review

* Remove full stops

* EDEBUG --> DEBUG
pull/5250/head
Tom Fifield 2024-11-04 20:09:23 +08:00 zatwierdzone przez GitHub
rodzic a628c93125
commit 276067065e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
34 zmienionych plików z 176 dodań i 248 usunięć

Wyświetl plik

@ -106,27 +106,27 @@ class AmbientLightingThread : public concurrency::OSThread
rgb.setRed(0); rgb.setRed(0);
rgb.setGreen(0); rgb.setGreen(0);
rgb.setBlue(0); rgb.setBlue(0);
LOG_INFO("Turn Off NCP5623 Ambient lighting."); LOG_INFO("Turn Off NCP5623 Ambient lighting");
#endif #endif
#ifdef HAS_NEOPIXEL #ifdef HAS_NEOPIXEL
pixels.clear(); pixels.clear();
pixels.show(); pixels.show();
LOG_INFO("Turn Off NeoPixel Ambient lighting."); LOG_INFO("Turn Off NeoPixel Ambient lighting");
#endif #endif
#ifdef RGBLED_CA #ifdef RGBLED_CA
analogWrite(RGBLED_RED, 255 - 0); analogWrite(RGBLED_RED, 255 - 0);
analogWrite(RGBLED_GREEN, 255 - 0); analogWrite(RGBLED_GREEN, 255 - 0);
analogWrite(RGBLED_BLUE, 255 - 0); analogWrite(RGBLED_BLUE, 255 - 0);
LOG_INFO("Turn Off Ambient lighting RGB Common Anode."); LOG_INFO("Turn Off Ambient lighting RGB Common Anode");
#elif defined(RGBLED_RED) #elif defined(RGBLED_RED)
analogWrite(RGBLED_RED, 0); analogWrite(RGBLED_RED, 0);
analogWrite(RGBLED_GREEN, 0); analogWrite(RGBLED_GREEN, 0);
analogWrite(RGBLED_BLUE, 0); analogWrite(RGBLED_BLUE, 0);
LOG_INFO("Turn Off Ambient lighting RGB Common Cathode."); LOG_INFO("Turn Off Ambient lighting RGB Common Cathode");
#endif #endif
#ifdef UNPHONE #ifdef UNPHONE
unphone.rgb(0, 0, 0); unphone.rgb(0, 0, 0);
LOG_INFO("Turn Off unPhone Ambient lighting."); LOG_INFO("Turn Off unPhone Ambient lighting");
#endif #endif
return 0; return 0;
} }
@ -183,4 +183,4 @@ class AmbientLightingThread : public concurrency::OSThread
} }
}; };
} // namespace concurrency } // namespace concurrency

Wyświetl plik

@ -50,9 +50,6 @@ class GPSStatus : public Status
int32_t getLatitude() const int32_t getLatitude() const
{ {
if (config.position.fixed_position) { if (config.position.fixed_position) {
#ifdef GPS_EXTRAVERBOSE
LOG_WARN("Using fixed latitude");
#endif
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum()); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
return node->position.latitude_i; return node->position.latitude_i;
} else { } else {
@ -63,9 +60,6 @@ class GPSStatus : public Status
int32_t getLongitude() const int32_t getLongitude() const
{ {
if (config.position.fixed_position) { if (config.position.fixed_position) {
#ifdef GPS_EXTRAVERBOSE
LOG_WARN("Using fixed longitude");
#endif
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum()); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
return node->position.longitude_i; return node->position.longitude_i;
} else { } else {
@ -76,9 +70,6 @@ class GPSStatus : public Status
int32_t getAltitude() const int32_t getAltitude() const
{ {
if (config.position.fixed_position) { if (config.position.fixed_position) {
#ifdef GPS_EXTRAVERBOSE
LOG_WARN("Using fixed altitude");
#endif
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum()); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
return node->position.altitude; return node->position.altitude;
} else { } else {
@ -94,7 +85,7 @@ class GPSStatus : public Status
bool matches(const GPSStatus *newStatus) const bool matches(const GPSStatus *newStatus) const
{ {
#ifdef GPS_EXTRAVERBOSE #ifdef GPS_DEBUG
LOG_DEBUG("GPSStatus.match() new pos@%x to old pos@%x", newStatus->p.timestamp, p.timestamp); LOG_DEBUG("GPSStatus.match() new pos@%x to old pos@%x", newStatus->p.timestamp, p.timestamp);
#endif #endif
return (newStatus->hasLock != hasLock || newStatus->isConnected != isConnected || return (newStatus->hasLock != hasLock || newStatus->isConnected != isConnected ||

Wyświetl plik

@ -12,7 +12,6 @@ void GpioVirtPin::set(bool value)
void GpioHwPin::set(bool value) void GpioHwPin::set(bool value)
{ {
// if (num == 3) LOG_DEBUG("Setting pin %d to %d", num, value);
pinMode(num, OUTPUT); pinMode(num, OUTPUT);
digitalWrite(num, value); digitalWrite(num, value);
} }
@ -88,7 +87,6 @@ void GpioBinaryTransformer::update()
newValue = (GpioVirtPin::PinState)(p1 && p2); newValue = (GpioVirtPin::PinState)(p1 && p2);
break; break;
case Or: case Or:
// LOG_DEBUG("Doing GPIO OR");
newValue = (GpioVirtPin::PinState)(p1 || p2); newValue = (GpioVirtPin::PinState)(p1 || p2);
break; break;
case Xor: case Xor:
@ -101,4 +99,4 @@ void GpioBinaryTransformer::update()
set(newValue); set(newValue);
} }
GpioSplitter::GpioSplitter(GpioPin *outPin1, GpioPin *outPin2) : outPin1(outPin1), outPin2(outPin2) {} GpioSplitter::GpioSplitter(GpioPin *outPin1, GpioPin *outPin2) : outPin1(outPin1), outPin2(outPin2) {}

Wyświetl plik

@ -105,7 +105,6 @@ float AirTime::channelUtilizationPercent()
uint32_t sum = 0; uint32_t sum = 0;
for (uint32_t i = 0; i < CHANNEL_UTILIZATION_PERIODS; i++) { for (uint32_t i = 0; i < CHANNEL_UTILIZATION_PERIODS; i++) {
sum += this->channelUtilization[i]; sum += this->channelUtilization[i];
// LOG_DEBUG("ChanUtilArray %u %u", i, this->channelUtilization[i]);
} }
return (float(sum) / float(CHANNEL_UTILIZATION_PERIODS * 10 * 1000)) * 100; return (float(sum) / float(CHANNEL_UTILIZATION_PERIODS * 10 * 1000)) * 100;
@ -208,14 +207,5 @@ int32_t AirTime::runOnce()
this->utilizationTX[utilPeriodTX] = 0; this->utilizationTX[utilPeriodTX] = 0;
} }
} }
/*
LOG_DEBUG("utilPeriodTX %d TX Airtime %3.2f%", utilPeriodTX, airTime->utilizationTXPercent());
for (uint32_t i = 0; i < MINUTES_IN_HOUR; i++) {
LOG_DEBUG(
"%d,", this->utilizationTX[i]
);
}
LOG_DEBUG("");
*/
return (1000 * 1); return (1000 * 1);
} }

Wyświetl plik

@ -156,7 +156,7 @@ uint8_t GPS::makeCASPacket(uint8_t class_id, uint8_t msg_id, uint8_t payload_siz
CASChecksum(UBXscratch, (payload_size + 10)); CASChecksum(UBXscratch, (payload_size + 10));
#if defined(GPS_DEBUG) && defined(DEBUG_PORT) #if defined(GPS_DEBUG) && defined(DEBUG_PORT)
LOG_DEBUG("Constructed CAS packet: "); LOG_DEBUG("CAS packet: ");
DEBUG_PORT.hexDump(MESHTASTIC_LOG_LEVEL_DEBUG, UBXscratch, payload_size + 10); DEBUG_PORT.hexDump(MESHTASTIC_LOG_LEVEL_DEBUG, UBXscratch, payload_size + 10);
#endif #endif
return (payload_size + 10); return (payload_size + 10);
@ -237,7 +237,7 @@ GPS_RESPONSE GPS::getACKCas(uint8_t class_id, uint8_t msg_id, uint32_t waitMilli
// Check for an ACK-ACK for the specified class and message id // Check for an ACK-ACK for the specified class and message id
if ((msg_cls == 0x05) && (msg_msg_id == 0x01) && payload_cls == class_id && payload_msg == msg_id) { if ((msg_cls == 0x05) && (msg_msg_id == 0x01) && payload_cls == class_id && payload_msg == msg_id) {
#ifdef GPS_DEBUG #ifdef GPS_DEBUG
LOG_INFO("Got ACK for class %02X message %02X in %d millis.", class_id, msg_id, millis() - startTime); LOG_INFO("Got ACK for class %02X message %02X in %dms", class_id, msg_id, millis() - startTime);
#endif #endif
return GNSS_RESPONSE_OK; return GNSS_RESPONSE_OK;
} }
@ -245,7 +245,7 @@ GPS_RESPONSE GPS::getACKCas(uint8_t class_id, uint8_t msg_id, uint32_t waitMilli
// Check for an ACK-NACK for the specified class and message id // Check for an ACK-NACK for the specified class and message id
if ((msg_cls == 0x05) && (msg_msg_id == 0x00) && payload_cls == class_id && payload_msg == msg_id) { if ((msg_cls == 0x05) && (msg_msg_id == 0x00) && payload_cls == class_id && payload_msg == msg_id) {
#ifdef GPS_DEBUG #ifdef GPS_DEBUG
LOG_WARN("Got NACK for class %02X message %02X in %d millis.", class_id, msg_id, millis() - startTime); LOG_WARN("Got NACK for class %02X message %02X in %dms", class_id, msg_id, millis() - startTime);
#endif #endif
return GNSS_RESPONSE_NAK; return GNSS_RESPONSE_NAK;
} }
@ -286,8 +286,7 @@ GPS_RESPONSE GPS::getACK(uint8_t class_id, uint8_t msg_id, uint32_t waitMillis)
while (Throttle::isWithinTimespanMs(startTime, waitMillis)) { while (Throttle::isWithinTimespanMs(startTime, waitMillis)) {
if (ack > 9) { if (ack > 9) {
#ifdef GPS_DEBUG #ifdef GPS_DEBUG
LOG_DEBUG(""); LOG_INFO("Got ACK for class %02X message %02X in %dms", class_id, msg_id, millis() - startTime);
LOG_INFO("Got ACK for class %02X message %02X in %d millis.", class_id, msg_id, millis() - startTime);
#endif #endif
return GNSS_RESPONSE_OK; // ACK received return GNSS_RESPONSE_OK; // ACK received
} }
@ -397,8 +396,7 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t
} else { } else {
// return payload length // return payload length
#ifdef GPS_DEBUG #ifdef GPS_DEBUG
LOG_INFO("Got ACK for class %02X message %02X in %d millis.", requestedClass, requestedID, LOG_INFO("Got ACK for class %02X message %02X in %dms", requestedClass, requestedID, millis() - startTime);
millis() - startTime);
#endif #endif
return needRead; return needRead;
} }
@ -409,7 +407,6 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t
} }
} }
} }
// LOG_WARN("No response for class %02X message %02X", requestedClass, requestedID);
return 0; return 0;
} }
@ -507,14 +504,14 @@ bool GPS::setup()
msglen = makeCASPacket(0x06, 0x07, sizeof(_message_CAS_CFG_NAVX_CONF), _message_CAS_CFG_NAVX_CONF); msglen = makeCASPacket(0x06, 0x07, sizeof(_message_CAS_CFG_NAVX_CONF), _message_CAS_CFG_NAVX_CONF);
_serial_gps->write(UBXscratch, msglen); _serial_gps->write(UBXscratch, msglen);
if (getACKCas(0x06, 0x07, 250) != GNSS_RESPONSE_OK) { if (getACKCas(0x06, 0x07, 250) != GNSS_RESPONSE_OK) {
LOG_WARN("ATGM336H - Could not set Configuration"); LOG_WARN("ATGM336H: Could not set Config");
} }
// Set the update frequence to 1Hz // Set the update frequence to 1Hz
msglen = makeCASPacket(0x06, 0x04, sizeof(_message_CAS_CFG_RATE_1HZ), _message_CAS_CFG_RATE_1HZ); msglen = makeCASPacket(0x06, 0x04, sizeof(_message_CAS_CFG_RATE_1HZ), _message_CAS_CFG_RATE_1HZ);
_serial_gps->write(UBXscratch, msglen); _serial_gps->write(UBXscratch, msglen);
if (getACKCas(0x06, 0x04, 250) != GNSS_RESPONSE_OK) { if (getACKCas(0x06, 0x04, 250) != GNSS_RESPONSE_OK) {
LOG_WARN("ATGM336H - Could not set Update Frequency"); LOG_WARN("ATGM336H: Could not set Update Frequency");
} }
// Set the NEMA output messages // Set the NEMA output messages
@ -526,7 +523,7 @@ bool GPS::setup()
msglen = makeCASPacket(0x06, 0x01, sizeof(cas_cfg_msg_packet), cas_cfg_msg_packet); msglen = makeCASPacket(0x06, 0x01, sizeof(cas_cfg_msg_packet), cas_cfg_msg_packet);
_serial_gps->write(UBXscratch, msglen); _serial_gps->write(UBXscratch, msglen);
if (getACKCas(0x06, 0x01, 250) != GNSS_RESPONSE_OK) { if (getACKCas(0x06, 0x01, 250) != GNSS_RESPONSE_OK) {
LOG_WARN("ATGM336H - Could not enable NMEA MSG: %d", fields[i]); LOG_WARN("ATGM336H: Could not enable NMEA MSG: %d", fields[i]);
} }
} }
} else if (gnssModel == GNSS_MODEL_UC6580) { } else if (gnssModel == GNSS_MODEL_UC6580) {
@ -586,9 +583,9 @@ bool GPS::setup()
msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE); msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE);
_serial_gps->write(UBXscratch, msglen); _serial_gps->write(UBXscratch, msglen);
if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) { if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) {
LOG_WARN("Unable to save GNSS module configuration."); LOG_WARN("Unable to save GNSS module config");
} else { } else {
LOG_INFO("GNSS module configuration saved!"); LOG_INFO("GNSS module config saved!");
} }
} else if (IS_ONE_OF(gnssModel, GNSS_MODEL_UBLOX7, GNSS_MODEL_UBLOX8, GNSS_MODEL_UBLOX9)) { } else if (IS_ONE_OF(gnssModel, GNSS_MODEL_UBLOX7, GNSS_MODEL_UBLOX8, GNSS_MODEL_UBLOX9)) {
if (gnssModel == GNSS_MODEL_UBLOX7) { if (gnssModel == GNSS_MODEL_UBLOX7) {
@ -602,12 +599,12 @@ bool GPS::setup()
if (getACK(0x06, 0x3e, 800) == GNSS_RESPONSE_NAK) { if (getACK(0x06, 0x3e, 800) == GNSS_RESPONSE_NAK) {
// It's not critical if the module doesn't acknowledge this configuration. // It's not critical if the module doesn't acknowledge this configuration.
LOG_INFO("reconfigure GNSS - defaults maintained. Is this module GPS-only?"); LOG_DEBUG("reconfigure GNSS - defaults maintained. Is this module GPS-only?");
} else { } else {
if (gnssModel == GNSS_MODEL_UBLOX7) { if (gnssModel == GNSS_MODEL_UBLOX7) {
LOG_INFO("GNSS configured for GPS+SBAS."); LOG_INFO("GPS+SBAS configured");
} else { // 8,9 } else { // 8,9
LOG_INFO("GNSS configured for GPS+SBAS+GLONASS+Galileo."); LOG_INFO("GPS+SBAS+GLONASS+Galileo configured");
} }
// Documentation say, we need wait atleast 0.5s after reconfiguration of GNSS module, before sending next // Documentation say, we need wait atleast 0.5s after reconfiguration of GNSS module, before sending next
// commands for the M8 it tends to be more... 1 sec should be enough ;>) // commands for the M8 it tends to be more... 1 sec should be enough ;>)
@ -655,7 +652,7 @@ bool GPS::setup()
msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE); msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE), _message_SAVE);
_serial_gps->write(UBXscratch, msglen); _serial_gps->write(UBXscratch, msglen);
if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) { if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) {
LOG_WARN("Unable to save GNSS module configuration."); LOG_WARN("Unable to save GNSS module config");
} else { } else {
LOG_INFO("GNSS module configuration saved!"); LOG_INFO("GNSS module configuration saved!");
} }
@ -703,7 +700,7 @@ bool GPS::setup()
msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE_10), _message_SAVE_10); msglen = makeUBXPacket(0x06, 0x09, sizeof(_message_SAVE_10), _message_SAVE_10);
_serial_gps->write(UBXscratch, msglen); _serial_gps->write(UBXscratch, msglen);
if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) { if (getACK(0x06, 0x09, 2000) != GNSS_RESPONSE_OK) {
LOG_WARN("Unable to save GNSS module configuration."); LOG_WARN("Unable to save GNSS module config");
} else { } else {
LOG_INFO("GNSS module configuration saved!"); LOG_INFO("GNSS module configuration saved!");
} }
@ -796,8 +793,8 @@ void GPS::writePinEN(bool on)
// Write and log // Write and log
enablePin->set(on); enablePin->set(on);
#ifdef GPS_EXTRAVERBOSE #ifdef GPS_DEBUG
LOG_DEBUG("Pin EN %s", val == HIGH ? "HIGH" : "LOW"); LOG_DEBUG("Pin EN %s", val == HIGH ? "HI" : "LOW");
#endif #endif
} }
@ -818,8 +815,8 @@ void GPS::writePinStandby(bool standby)
// Write and log // Write and log
pinMode(PIN_GPS_STANDBY, OUTPUT); pinMode(PIN_GPS_STANDBY, OUTPUT);
digitalWrite(PIN_GPS_STANDBY, val); digitalWrite(PIN_GPS_STANDBY, val);
#ifdef GPS_EXTRAVERBOSE #ifdef GPS_DEBUG
LOG_DEBUG("Pin STANDBY %s", val == HIGH ? "HIGH" : "LOW"); LOG_DEBUG("Pin STANDBY %s", val == HIGH ? "HI" : "LOW");
#endif #endif
#endif #endif
} }
@ -851,8 +848,7 @@ void GPS::setPowerPMU(bool on)
// t-beam v1.1 GNSS power channel // t-beam v1.1 GNSS power channel
on ? PMU->enablePowerOutput(XPOWERS_LDO3) : PMU->disablePowerOutput(XPOWERS_LDO3); on ? PMU->enablePowerOutput(XPOWERS_LDO3) : PMU->disablePowerOutput(XPOWERS_LDO3);
} }
#ifdef GPS_DEBUG
#ifdef GPS_EXTRAVERBOSE
LOG_DEBUG("PMU %s", on ? "on" : "off"); LOG_DEBUG("PMU %s", on ? "on" : "off");
#endif #endif
#endif #endif
@ -869,9 +865,6 @@ void GPS::setPowerUBLOX(bool on, uint32_t sleepMs)
if (on) { if (on) {
gps->_serial_gps->write(0xFF); gps->_serial_gps->write(0xFF);
clearBuffer(); // This often returns old data, so drop it clearBuffer(); // This often returns old data, so drop it
#ifdef GPS_EXTRAVERBOSE
LOG_DEBUG("UBLOX: wake");
#endif
} }
// If putting to sleep // If putting to sleep
@ -903,8 +896,7 @@ void GPS::setPowerUBLOX(bool on, uint32_t sleepMs)
// Send the UBX packet // Send the UBX packet
gps->_serial_gps->write(gps->UBXscratch, msglen); gps->_serial_gps->write(gps->UBXscratch, msglen);
#ifdef GPS_DEBUG
#ifdef GPS_EXTRAVERBOSE
LOG_DEBUG("UBLOX: sleep for %dmS", sleepMs); LOG_DEBUG("UBLOX: sleep for %dmS", sleepMs);
#endif #endif
} }
@ -992,7 +984,7 @@ int32_t GPS::runOnce()
{ {
if (!GPSInitFinished) { if (!GPSInitFinished) {
if (!_serial_gps || config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT) { if (!_serial_gps || config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT) {
LOG_INFO("GPS set to not-present. Skipping probe."); LOG_INFO("GPS set to not-present. Skipping probe");
return disable(); return disable();
} }
if (!setup()) if (!setup())
@ -1028,7 +1020,7 @@ int32_t GPS::runOnce()
GNSS_MODEL_UBLOX10)) { GNSS_MODEL_UBLOX10)) {
// reset the GPS on next bootup // reset the GPS on next bootup
if (devicestate.did_gps_reset && scheduling.elapsedSearchMs() > 60 * 1000UL && !hasFlow()) { if (devicestate.did_gps_reset && scheduling.elapsedSearchMs() > 60 * 1000UL && !hasFlow()) {
LOG_DEBUG("GPS is not communicating, trying factory reset on next bootup."); LOG_DEBUG("GPS is not communicating, trying factory reset on next boot");
devicestate.did_gps_reset = false; devicestate.did_gps_reset = false;
nodeDB->saveToDisk(SEGMENT_DEVICESTATE); nodeDB->saveToDisk(SEGMENT_DEVICESTATE);
return disable(); // Stop the GPS thread as it can do nothing useful until next reboot. return disable(); // Stop the GPS thread as it can do nothing useful until next reboot.
@ -1062,10 +1054,9 @@ int32_t GPS::runOnce()
bool tooLong = scheduling.searchedTooLong(); bool tooLong = scheduling.searchedTooLong();
if (tooLong) if (tooLong)
LOG_WARN("Couldn't publish a valid location: didn't get a GPS lock in time."); LOG_WARN("Couldn't publish a valid location: didn't get a GPS lock in time");
// Once we get a location we no longer desperately want an update // Once we get a location we no longer desperately want an update
// LOG_DEBUG("gotLoc %d, tooLong %d, gotTime %d", gotLoc, tooLong, gotTime);
if ((gotLoc && gotTime) || tooLong) { if ((gotLoc && gotTime) || tooLong) {
if (tooLong) { if (tooLong) {
@ -1201,7 +1192,6 @@ GnssModel_t GPS::probe(int serialSpeed)
uint16_t len = getACK(buffer, sizeof(buffer), 0x0A, 0x04, 1200); uint16_t len = getACK(buffer, sizeof(buffer), 0x0A, 0x04, 1200);
if (len) { if (len) {
// LOG_DEBUG("monver reply size = %d", len);
uint16_t position = 0; uint16_t position = 0;
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
info.swVersion[i] = buffer[position]; info.swVersion[i] = buffer[position];
@ -1387,26 +1377,22 @@ bool GPS::factoryReset()
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1C, 0xA2}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1C, 0xA2};
_serial_gps->write(_message_reset1, sizeof(_message_reset1)); _serial_gps->write(_message_reset1, sizeof(_message_reset1));
if (getACK(0x05, 0x01, 10000)) { if (getACK(0x05, 0x01, 10000)) {
LOG_INFO(ACK_SUCCESS_MESSAGE); LOG_DEBUG(ACK_SUCCESS_MESSAGE);
} }
delay(100); delay(100);
byte _message_reset2[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, byte _message_reset2[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1B, 0xA1}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1B, 0xA1};
_serial_gps->write(_message_reset2, sizeof(_message_reset2)); _serial_gps->write(_message_reset2, sizeof(_message_reset2));
if (getACK(0x05, 0x01, 10000)) { if (getACK(0x05, 0x01, 10000)) {
LOG_INFO(ACK_SUCCESS_MESSAGE); LOG_DEBUG(ACK_SUCCESS_MESSAGE);
} }
delay(100); delay(100);
byte _message_reset3[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, byte _message_reset3[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x03, 0x1D, 0xB3}; 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x03, 0x1D, 0xB3};
_serial_gps->write(_message_reset3, sizeof(_message_reset3)); _serial_gps->write(_message_reset3, sizeof(_message_reset3));
if (getACK(0x05, 0x01, 10000)) { if (getACK(0x05, 0x01, 10000)) {
LOG_INFO(ACK_SUCCESS_MESSAGE); LOG_DEBUG(ACK_SUCCESS_MESSAGE);
} }
// Reset device ram to COLDSTART state
// byte _message_CFG_RST_COLDSTART[] = {0xB5, 0x62, 0x06, 0x04, 0x04, 0x00, 0xFF, 0xB9, 0x00, 0x00, 0xC6, 0x8B};
// _serial_gps->write(_message_CFG_RST_COLDSTART, sizeof(_message_CFG_RST_COLDSTART));
// delay(1000);
} else if (gnssModel == GNSS_MODEL_MTK) { } else if (gnssModel == GNSS_MODEL_MTK) {
// send the CAS10 to perform a factory restart of the device (and other device that support PCAS statements) // send the CAS10 to perform a factory restart of the device (and other device that support PCAS statements)
LOG_INFO("GNSS Factory Reset via PCAS10,3"); LOG_INFO("GNSS Factory Reset via PCAS10,3");
@ -1518,7 +1504,7 @@ bool GPS::lookForLocation()
#ifndef TINYGPS_OPTION_NO_STATISTICS #ifndef TINYGPS_OPTION_NO_STATISTICS
if (reader.failedChecksum() > lastChecksumFailCount) { if (reader.failedChecksum() > lastChecksumFailCount) {
LOG_WARN("%u new GPS checksum failures, for a total of %u.", reader.failedChecksum() - lastChecksumFailCount, LOG_WARN("%u new GPS checksum failures, for a total of %u", reader.failedChecksum() - lastChecksumFailCount,
reader.failedChecksum()); reader.failedChecksum());
lastChecksumFailCount = reader.failedChecksum(); lastChecksumFailCount = reader.failedChecksum();
} }
@ -1526,14 +1512,13 @@ bool GPS::lookForLocation()
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS #ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
fixType = atoi(gsafixtype.value()); // will set to zero if no data fixType = atoi(gsafixtype.value()); // will set to zero if no data
// LOG_DEBUG("FIX QUAL=%d, TYPE=%d", fixQual, fixType);
#endif #endif
// check if GPS has an acceptable lock // check if GPS has an acceptable lock
if (!hasLock()) if (!hasLock())
return false; return false;
#ifdef GPS_EXTRAVERBOSE #ifdef GPS_DEBUG
LOG_DEBUG("AGE: LOC=%d FIX=%d DATE=%d TIME=%d", reader.location.age(), LOG_DEBUG("AGE: LOC=%d FIX=%d DATE=%d TIME=%d", reader.location.age(),
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS #ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
gsafixtype.age(), gsafixtype.age(),
@ -1541,7 +1526,7 @@ bool GPS::lookForLocation()
0, 0,
#endif #endif
reader.date.age(), reader.time.age()); reader.date.age(), reader.time.age());
#endif // GPS_EXTRAVERBOSE #endif // GPS_DEBUG
// Is this a new point or are we re-reading the previous one? // Is this a new point or are we re-reading the previous one?
if (!reader.location.isUpdated() && !reader.altitude.isUpdated()) if (!reader.location.isUpdated() && !reader.altitude.isUpdated())
@ -1564,13 +1549,13 @@ bool GPS::lookForLocation()
// Bail out EARLY to avoid overwriting previous good data (like #857) // Bail out EARLY to avoid overwriting previous good data (like #857)
if (toDegInt(loc.lat) > 900000000) { if (toDegInt(loc.lat) > 900000000) {
#ifdef GPS_EXTRAVERBOSE #ifdef GPS_DEBUG
LOG_DEBUG("Bail out EARLY on LAT %i", toDegInt(loc.lat)); LOG_DEBUG("Bail out EARLY on LAT %i", toDegInt(loc.lat));
#endif #endif
return false; return false;
} }
if (toDegInt(loc.lng) > 1800000000) { if (toDegInt(loc.lng) > 1800000000) {
#ifdef GPS_EXTRAVERBOSE #ifdef GPS_DEBUG
LOG_DEBUG("Bail out EARLY on LNG %i", toDegInt(loc.lng)); LOG_DEBUG("Bail out EARLY on LNG %i", toDegInt(loc.lng));
#endif #endif
return false; return false;
@ -1582,7 +1567,6 @@ bool GPS::lookForLocation()
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS #ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
p.HDOP = reader.hdop.value(); p.HDOP = reader.hdop.value();
p.PDOP = TinyGPSPlus::parseDecimal(gsapdop.value()); p.PDOP = TinyGPSPlus::parseDecimal(gsapdop.value());
// LOG_DEBUG("PDOP=%d, HDOP=%d", p.PDOP, p.HDOP);
#else #else
// FIXME! naive PDOP emulation (assumes VDOP==HDOP) // FIXME! naive PDOP emulation (assumes VDOP==HDOP)
// correct formula is PDOP = SQRT(HDOP^2 + VDOP^2) // correct formula is PDOP = SQRT(HDOP^2 + VDOP^2)
@ -1672,12 +1656,10 @@ bool GPS::whileActive()
} }
#ifdef SERIAL_BUFFER_SIZE #ifdef SERIAL_BUFFER_SIZE
if (_serial_gps->available() >= SERIAL_BUFFER_SIZE - 1) { if (_serial_gps->available() >= SERIAL_BUFFER_SIZE - 1) {
LOG_WARN("GPS Buffer full with %u bytes waiting. Flushing to avoid corruption.", _serial_gps->available()); LOG_WARN("GPS Buffer full with %u bytes waiting. Flushing to avoid corruption", _serial_gps->available());
clearBuffer(); clearBuffer();
} }
#endif #endif
// if (_serial_gps->available() > 0)
// LOG_DEBUG("GPS Bytes Waiting: %u", _serial_gps->available());
// First consume any chars that have piled up at the receiver // First consume any chars that have piled up at the receiver
while (_serial_gps->available() > 0) { while (_serial_gps->available() > 0) {
int c = _serial_gps->read(); int c = _serial_gps->read();
@ -1727,7 +1709,7 @@ void GPS::toggleGpsMode()
{ {
if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) { if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_DISABLED; config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_DISABLED;
LOG_INFO("User toggled GpsMode. Now DISABLED."); LOG_INFO("User toggled GpsMode. Now DISABLED");
playGPSDisableBeep(); playGPSDisableBeep();
#ifdef GNSS_AIROHA #ifdef GNSS_AIROHA
if (powerState == GPS_ACTIVE) { if (powerState == GPS_ACTIVE) {
@ -1743,4 +1725,4 @@ void GPS::toggleGpsMode()
enable(); enable();
} }
} }
#endif // Exclude GPS #endif // Exclude GPS

Wyświetl plik

@ -389,10 +389,10 @@ void setup()
Wire.begin(I2C_SDA, I2C_SCL); Wire.begin(I2C_SDA, I2C_SCL);
#elif defined(ARCH_PORTDUINO) #elif defined(ARCH_PORTDUINO)
if (settingsStrings[i2cdev] != "") { if (settingsStrings[i2cdev] != "") {
LOG_INFO("Using %s as I2C device.", settingsStrings[i2cdev].c_str()); LOG_INFO("Using %s as I2C device", settingsStrings[i2cdev].c_str());
Wire.begin(settingsStrings[i2cdev].c_str()); Wire.begin(settingsStrings[i2cdev].c_str());
} else { } else {
LOG_INFO("No I2C device configured, skipping."); LOG_INFO("No I2C device configured, skipping");
} }
#elif HAS_WIRE #elif HAS_WIRE
Wire.begin(); Wire.begin();
@ -770,7 +770,7 @@ void setup()
if (gps) { if (gps) {
gpsStatus->observe(&gps->newStatus); gpsStatus->observe(&gps->newStatus);
} else { } else {
LOG_DEBUG("Running without GPS."); LOG_DEBUG("Running without GPS");
} }
} }
} }
@ -1070,7 +1070,7 @@ void setup()
// check if the radio chip matches the selected region // check if the radio chip matches the selected region
if ((config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) { if ((config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) {
LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset."); LOG_WARN("LoRa chip does not support 2.4GHz. Reverting to unset");
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET; config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET;
nodeDB->saveToDisk(SEGMENT_CONFIG); nodeDB->saveToDisk(SEGMENT_CONFIG);
if (!rIf->reconfigure()) { if (!rIf->reconfigure()) {

Wyświetl plik

@ -18,7 +18,7 @@
*/ */
void CryptoEngine::generateKeyPair(uint8_t *pubKey, uint8_t *privKey) void CryptoEngine::generateKeyPair(uint8_t *pubKey, uint8_t *privKey)
{ {
LOG_DEBUG("Generating Curve25519 key pair..."); LOG_DEBUG("Generating Curve25519 keypair");
Curve25519::dh1(public_key, private_key); Curve25519::dh1(public_key, private_key);
memcpy(pubKey, public_key, sizeof(public_key)); memcpy(pubKey, public_key, sizeof(public_key));
memcpy(privKey, private_key, sizeof(private_key)); memcpy(privKey, private_key, sizeof(private_key));
@ -249,4 +249,4 @@ void CryptoEngine::initNonce(uint32_t fromNode, uint64_t packetId, uint32_t extr
} }
#ifndef HAS_CUSTOM_CRYPTO_ENGINE #ifndef HAS_CUSTOM_CRYPTO_ENGINE
CryptoEngine *crypto = new CryptoEngine; CryptoEngine *crypto = new CryptoEngine;
#endif #endif

Wyświetl plik

@ -46,7 +46,7 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
bool isAckorReply = (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) && (p->decoded.request_id != 0); bool isAckorReply = (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) && (p->decoded.request_id != 0);
if (isAckorReply && !isToUs(p) && !isBroadcast(p->to)) { if (isAckorReply && !isToUs(p) && !isBroadcast(p->to)) {
// do not flood direct message that is ACKed or replied to // do not flood direct message that is ACKed or replied to
LOG_DEBUG("Rxd an ACK/reply not for me, cancel rebroadcast."); LOG_DEBUG("Rxd an ACK/reply not for me, cancel rebroadcast");
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
} }
if (!isToUs(p) && (p->hop_limit > 0) && !isFromUs(p)) { if (!isToUs(p) && (p->hop_limit > 0) && !isFromUs(p)) {
@ -76,4 +76,4 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
} }
// handle the packet as normal // handle the packet as normal
Router::sniffReceived(p, c); Router::sniffReceived(p, c);
} }

Wyświetl plik

@ -83,15 +83,15 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_REPEATER); IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_ROUTER, meshtastic_Config_DeviceConfig_Role_REPEATER);
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
mp->decoded.portnum == meshtastic_PortNum_TELEMETRY_APP && mp->decoded.request_id > 0) { mp->decoded.portnum == meshtastic_PortNum_TELEMETRY_APP && mp->decoded.request_id > 0) {
LOG_DEBUG("Received telemetry response. Skip sending our NodeInfo."); // because this potentially a Repeater which will LOG_DEBUG("Received telemetry response. Skip sending our NodeInfo"); // because this potentially a Repeater which will
// ignore our request for its NodeInfo // ignore our request for its NodeInfo
} else if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB->getMeshNode(mp->from)->has_user && } else if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB->getMeshNode(mp->from)->has_user &&
nodeInfoModule && !isPreferredRebroadcaster) { nodeInfoModule && !isPreferredRebroadcaster) {
if (airTime->isTxAllowedChannelUtil(true)) { if (airTime->isTxAllowedChannelUtil(true)) {
LOG_INFO("Heard new node on channel %d, sending NodeInfo and asking for a response.", mp->channel); LOG_INFO("Heard new node on chan %d, sending NodeInfo and asking for a response", mp->channel);
nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel); nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel);
} else { } else {
LOG_DEBUG("Skip sending NodeInfo due to > 25 percent channel util."); LOG_DEBUG("Skip sending NodeInfo due to > 25 percent chan util");
} }
} }
@ -306,7 +306,7 @@ void MeshService::sendToPhone(meshtastic_MeshPacket *p)
if (d) if (d)
releaseToPool(d); releaseToPool(d);
} else { } else {
LOG_WARN("ToPhone queue is full, dropping packet."); LOG_WARN("ToPhone queue is full, dropping packet");
releaseToPool(p); releaseToPool(p);
fromNum++; // Make sure to notify observers in case they are reconnected so they can get the packets fromNum++; // Make sure to notify observers in case they are reconnected so they can get the packets
return; return;
@ -383,7 +383,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
pos = gps->p; pos = gps->p;
} else { } else {
// The GPS has lost lock // The GPS has lost lock
#ifdef GPS_EXTRAVERBOSE #ifdef GPS_DEBUG
LOG_DEBUG("onGPSchanged() - lost validLocation"); LOG_DEBUG("onGPSchanged() - lost validLocation");
#endif #endif
} }

Wyświetl plik

@ -1279,4 +1279,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
LOG_ERROR("A critical failure occurred, portduino is exiting..."); LOG_ERROR("A critical failure occurred, portduino is exiting...");
exit(2); exit(2);
#endif #endif
} }

Wyświetl plik

@ -64,7 +64,7 @@ void PhoneAPI::handleStartConfig()
void PhoneAPI::close() void PhoneAPI::close()
{ {
LOG_INFO("PhoneAPI::close()"); LOG_DEBUG("PhoneAPI::close()");
if (state != STATE_SEND_NOTHING) { if (state != STATE_SEND_NOTHING) {
state = STATE_SEND_NOTHING; state = STATE_SEND_NOTHING;
@ -133,7 +133,7 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
break; break;
#if !MESHTASTIC_EXCLUDE_MQTT #if !MESHTASTIC_EXCLUDE_MQTT
case meshtastic_ToRadio_mqttClientProxyMessage_tag: case meshtastic_ToRadio_mqttClientProxyMessage_tag:
LOG_INFO("Got MqttClientProxy message"); LOG_DEBUG("Got MqttClientProxy message");
if (mqtt && moduleConfig.mqtt.proxy_to_client_enabled && moduleConfig.mqtt.enabled && if (mqtt && moduleConfig.mqtt.proxy_to_client_enabled && moduleConfig.mqtt.enabled &&
(channels.anyMqttEnabled() || moduleConfig.mqtt.map_reporting_enabled)) { (channels.anyMqttEnabled() || moduleConfig.mqtt.map_reporting_enabled)) {
mqtt->onClientProxyReceive(toRadioScratch.mqttClientProxyMessage); mqtt->onClientProxyReceive(toRadioScratch.mqttClientProxyMessage);
@ -148,7 +148,6 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
break; break;
default: default:
// Ignore nop messages // Ignore nop messages
// LOG_DEBUG("Error: unexpected ToRadio variant");
break; break;
} }
} else { } else {
@ -179,7 +178,6 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
size_t PhoneAPI::getFromRadio(uint8_t *buf) size_t PhoneAPI::getFromRadio(uint8_t *buf)
{ {
if (!available()) { if (!available()) {
// LOG_DEBUG("getFromRadio=not available");
return 0; return 0;
} }
// In case we send a FromRadio packet // In case we send a FromRadio packet
@ -188,11 +186,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
// Advance states as needed // Advance states as needed
switch (state) { switch (state) {
case STATE_SEND_NOTHING: case STATE_SEND_NOTHING:
LOG_INFO("getFromRadio=STATE_SEND_NOTHING"); LOG_DEBUG("getFromRadio=STATE_SEND_NOTHING");
break; break;
case STATE_SEND_MY_INFO: case STATE_SEND_MY_INFO:
LOG_INFO("getFromRadio=STATE_SEND_MY_INFO"); LOG_DEBUG("getFromRadio=STATE_SEND_MY_INFO");
// If the user has specified they don't want our node to share its location, make sure to tell the phone // If the user has specified they don't want our node to share its location, make sure to tell the phone
// app not to send locations on our behalf. // app not to send locations on our behalf.
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag;
@ -204,7 +202,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
break; break;
case STATE_SEND_OWN_NODEINFO: { case STATE_SEND_OWN_NODEINFO: {
LOG_INFO("getFromRadio=STATE_SEND_OWN_NODEINFO"); LOG_DEBUG("Sending My NodeInfo");
auto us = nodeDB->readNextMeshNode(readIndex); auto us = nodeDB->readNextMeshNode(readIndex);
if (us) { if (us) {
nodeInfoForPhone = TypeConversions::ConvertToNodeInfo(us); nodeInfoForPhone = TypeConversions::ConvertToNodeInfo(us);
@ -220,14 +218,14 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
} }
case STATE_SEND_METADATA: case STATE_SEND_METADATA:
LOG_INFO("getFromRadio=STATE_SEND_METADATA"); LOG_DEBUG("Sending Metadata");
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_metadata_tag; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_metadata_tag;
fromRadioScratch.metadata = getDeviceMetadata(); fromRadioScratch.metadata = getDeviceMetadata();
state = STATE_SEND_CHANNELS; state = STATE_SEND_CHANNELS;
break; break;
case STATE_SEND_CHANNELS: case STATE_SEND_CHANNELS:
LOG_INFO("getFromRadio=STATE_SEND_CHANNELS"); LOG_DEBUG("Sending Channels");
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_channel_tag; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_channel_tag;
fromRadioScratch.channel = channels.getByIndex(config_state); fromRadioScratch.channel = channels.getByIndex(config_state);
config_state++; config_state++;
@ -239,7 +237,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
break; break;
case STATE_SEND_CONFIG: case STATE_SEND_CONFIG:
LOG_INFO("getFromRadio=STATE_SEND_CONFIG"); LOG_DEBUG("Sending Radio config");
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_tag; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_tag;
switch (config_state) { switch (config_state) {
case meshtastic_Config_device_tag: case meshtastic_Config_device_tag:
@ -294,7 +292,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
break; break;
case STATE_SEND_MODULECONFIG: case STATE_SEND_MODULECONFIG:
LOG_INFO("getFromRadio=STATE_SEND_MODULECONFIG"); LOG_DEBUG("Sending Module Config");
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_moduleConfig_tag; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_moduleConfig_tag;
switch (config_state) { switch (config_state) {
case meshtastic_ModuleConfig_mqtt_tag: case meshtastic_ModuleConfig_mqtt_tag:
@ -363,7 +361,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
break; break;
case STATE_SEND_OTHER_NODEINFOS: { case STATE_SEND_OTHER_NODEINFOS: {
LOG_INFO("getFromRadio=STATE_SEND_OTHER_NODEINFOS"); LOG_DEBUG("Sending known nodes");
if (nodeInfoForPhone.num != 0) { if (nodeInfoForPhone.num != 0) {
LOG_INFO("nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s", nodeInfoForPhone.num, nodeInfoForPhone.last_heard, LOG_INFO("nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s", nodeInfoForPhone.num, nodeInfoForPhone.last_heard,
nodeInfoForPhone.user.id, nodeInfoForPhone.user.long_name); nodeInfoForPhone.user.id, nodeInfoForPhone.user.long_name);
@ -372,7 +370,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
// Stay in current state until done sending nodeinfos // Stay in current state until done sending nodeinfos
nodeInfoForPhone.num = 0; // We just consumed a nodeinfo, will need a new one next time nodeInfoForPhone.num = 0; // We just consumed a nodeinfo, will need a new one next time
} else { } else {
LOG_INFO("Done sending nodeinfos"); LOG_DEBUG("Done sending nodeinfo");
state = STATE_SEND_FILEMANIFEST; state = STATE_SEND_FILEMANIFEST;
// Go ahead and send that ID right now // Go ahead and send that ID right now
return getFromRadio(buf); return getFromRadio(buf);
@ -381,7 +379,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
} }
case STATE_SEND_FILEMANIFEST: { case STATE_SEND_FILEMANIFEST: {
LOG_INFO("getFromRadio=STATE_SEND_FILEMANIFEST"); LOG_DEBUG("getFromRadio=STATE_SEND_FILEMANIFEST");
// last element // last element
if (config_state == filesManifest.size()) { // also handles an empty filesManifest if (config_state == filesManifest.size()) { // also handles an empty filesManifest
config_state = 0; config_state = 0;
@ -404,7 +402,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
case STATE_SEND_PACKETS: case STATE_SEND_PACKETS:
pauseBluetoothLogging = false; pauseBluetoothLogging = false;
// Do we have a message from the mesh or packet from the local device? // Do we have a message from the mesh or packet from the local device?
LOG_INFO("getFromRadio=STATE_SEND_PACKETS"); LOG_DEBUG("getFromRadio=STATE_SEND_PACKETS");
if (queueStatusPacketForPhone) { if (queueStatusPacketForPhone) {
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_queueStatus_tag; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_queueStatus_tag;
fromRadioScratch.queueStatus = *queueStatusPacketForPhone; fromRadioScratch.queueStatus = *queueStatusPacketForPhone;
@ -442,7 +440,6 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
// VERY IMPORTANT to not print debug messages while writing to fromRadioScratch - because we use that same buffer // VERY IMPORTANT to not print debug messages while writing to fromRadioScratch - because we use that same buffer
// for logging (when we are encapsulating with protobufs) // for logging (when we are encapsulating with protobufs)
// LOG_DEBUG("encoding toPhone packet to phone variant=%d, %d bytes", fromRadioScratch.which_payload_variant, numbytes);
return numbytes; return numbytes;
} }
@ -452,7 +449,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
void PhoneAPI::sendConfigComplete() void PhoneAPI::sendConfigComplete()
{ {
LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID"); LOG_INFO("Config Send Complete");
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag;
fromRadioScratch.config_complete_id = config_nonce; fromRadioScratch.config_complete_id = config_nonce;
config_nonce = 0; config_nonce = 0;
@ -552,7 +549,6 @@ bool PhoneAPI::available()
if (!packetForPhone) if (!packetForPhone)
packetForPhone = service->getForPhone(); packetForPhone = service->getForPhone();
hasPacket = !!packetForPhone; hasPacket = !!packetForPhone;
// LOG_DEBUG("available hasPacket=%d", hasPacket);
return hasPacket; return hasPacket;
} }
default: default:
@ -640,4 +636,4 @@ int PhoneAPI::onNotify(uint32_t newValue)
} }
return timeout ? -1 : 0; // If we timed out, MeshService should stop iterating through observers as we just removed one return timeout ? -1 : 0; // If we timed out, MeshService should stop iterating through observers as we just removed one
} }

Wyświetl plik

@ -346,7 +346,7 @@ bool RadioInterface::reconfigure()
bool RadioInterface::init() bool RadioInterface::init()
{ {
LOG_INFO("Starting meshradio init..."); LOG_INFO("Starting meshradio init");
configChangedObserver.observe(&service->configChanged); configChangedObserver.observe(&service->configChanged);
preflightSleepObserver.observe(&preflightSleep); preflightSleepObserver.observe(&preflightSleep);
@ -494,7 +494,7 @@ void RadioInterface::applyModemConfig()
} }
if ((myRegion->freqEnd - myRegion->freqStart) < bw / 1000) { if ((myRegion->freqEnd - myRegion->freqStart) < bw / 1000) {
static const char *err_string = "Regional frequency range is smaller than bandwidth. Falling back to default preset."; static const char *err_string = "Regional frequency range is smaller than bandwidth. Falling back to default preset";
LOG_ERROR(err_string); LOG_ERROR(err_string);
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);

Wyświetl plik

@ -143,12 +143,12 @@ bool RadioLibInterface::receiveDetected(uint16_t irq, ulong syncWordHeaderValidF
} else if (!Throttle::isWithinTimespanMs(activeReceiveStart, 2 * preambleTimeMsec) && !(irq & syncWordHeaderValidFlag)) { } else if (!Throttle::isWithinTimespanMs(activeReceiveStart, 2 * preambleTimeMsec) && !(irq & syncWordHeaderValidFlag)) {
// The HEADER_VALID flag should be set by now if it was really a packet, so ignore PREAMBLE_DETECTED flag // The HEADER_VALID flag should be set by now if it was really a packet, so ignore PREAMBLE_DETECTED flag
activeReceiveStart = 0; activeReceiveStart = 0;
LOG_DEBUG("Ignore false preamble detection."); LOG_DEBUG("Ignore false preamble detection");
return false; return false;
} else if (!Throttle::isWithinTimespanMs(activeReceiveStart, maxPacketTimeMsec)) { } else if (!Throttle::isWithinTimespanMs(activeReceiveStart, maxPacketTimeMsec)) {
// We should have gotten an RX_DONE IRQ by now if it was really a packet, so ignore HEADER_VALID flag // We should have gotten an RX_DONE IRQ by now if it was really a packet, so ignore HEADER_VALID flag
activeReceiveStart = 0; activeReceiveStart = 0;
LOG_DEBUG("Ignore false header detection."); LOG_DEBUG("Ignore false header detection");
return false; return false;
} }
} }
@ -171,7 +171,7 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
} }
} else { } else {
LOG_WARN("send - lora tx disabled because RegionCode_Unset"); LOG_WARN("send - lora tx disabled: Region unset");
packetPool.release(p); packetPool.release(p);
return ERRNO_DISABLED; return ERRNO_DISABLED;
} }
@ -200,7 +200,6 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
// set (random) transmit delay to let others reconfigure their radio, // set (random) transmit delay to let others reconfigure their radio,
// to avoid collisions and implement timing-based flooding // to avoid collisions and implement timing-based flooding
// LOG_DEBUG("Set random delay before transmitting.");
setTransmitDelay(); setTransmitDelay();
return res; return res;
@ -255,28 +254,23 @@ void RadioLibInterface::onNotify(uint32_t notification)
case ISR_TX: case ISR_TX:
handleTransmitInterrupt(); handleTransmitInterrupt();
startReceive(); startReceive();
// LOG_DEBUG("tx complete - starting timer");
startTransmitTimer(); startTransmitTimer();
break; break;
case ISR_RX: case ISR_RX:
handleReceiveInterrupt(); handleReceiveInterrupt();
startReceive(); startReceive();
// LOG_DEBUG("rx complete - starting timer");
startTransmitTimer(); startTransmitTimer();
break; break;
case TRANSMIT_DELAY_COMPLETED: case TRANSMIT_DELAY_COMPLETED:
// LOG_DEBUG("delay done");
// If we are not currently in receive mode, then restart the random delay (this can happen if the main thread // If we are not currently in receive mode, then restart the random delay (this can happen if the main thread
// has placed the unit into standby) FIXME, how will this work if the chipset is in sleep mode? // has placed the unit into standby) FIXME, how will this work if the chipset is in sleep mode?
if (!txQueue.empty()) { if (!txQueue.empty()) {
if (!canSendImmediately()) { if (!canSendImmediately()) {
// LOG_DEBUG("Currently Rx/Tx-ing: set random delay");
setTransmitDelay(); // currently Rx/Tx-ing: reset random delay setTransmitDelay(); // currently Rx/Tx-ing: reset random delay
} else { } else {
if (isChannelActive()) { // check if there is currently a LoRa packet on the channel if (isChannelActive()) { // check if there is currently a LoRa packet on the channel
// LOG_DEBUG("Channel is active, try receiving first."); startReceive(); // try receiving this packet, afterwards we'll be trying to transmit again
startReceive(); // try receiving this packet, afterwards we'll be trying to transmit again
setTransmitDelay(); setTransmitDelay();
} else { } else {
// Send any outgoing packets we have ready // Send any outgoing packets we have ready
@ -293,7 +287,6 @@ void RadioLibInterface::onNotify(uint32_t notification)
} }
} }
} else { } else {
// LOG_DEBUG("done with txqueue");
} }
break; break;
default: default:
@ -326,7 +319,6 @@ void RadioLibInterface::startTransmitTimer(bool withDelay)
// If we have work to do and the timer wasn't already scheduled, schedule it now // If we have work to do and the timer wasn't already scheduled, schedule it now
if (!txQueue.empty()) { if (!txQueue.empty()) {
uint32_t delay = !withDelay ? 1 : getTxDelayMsec(); uint32_t delay = !withDelay ? 1 : getTxDelayMsec();
// LOG_DEBUG("xmit timer %d", delay);
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
} }
} }
@ -336,14 +328,12 @@ void RadioLibInterface::startTransmitTimerSNR(float snr)
// If we have work to do and the timer wasn't already scheduled, schedule it now // If we have work to do and the timer wasn't already scheduled, schedule it now
if (!txQueue.empty()) { if (!txQueue.empty()) {
uint32_t delay = getTxDelayMsecWeighted(snr); uint32_t delay = getTxDelayMsecWeighted(snr);
// LOG_DEBUG("xmit timer %d", delay);
notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable notifyLater(delay, TRANSMIT_DELAY_COMPLETED, false); // This will implicitly enable
} }
} }
void RadioLibInterface::handleTransmitInterrupt() void RadioLibInterface::handleTransmitInterrupt()
{ {
// LOG_DEBUG("handling lora TX interrupt");
// This can be null if we forced the device to enter standby mode. In that case // This can be null if we forced the device to enter standby mode. In that case
// ignore the transmit interrupt // ignore the transmit interrupt
if (sendingPacket) if (sendingPacket)
@ -366,7 +356,6 @@ void RadioLibInterface::completeSending()
// We are done sending that packet, release it // We are done sending that packet, release it
packetPool.release(p); packetPool.release(p);
// LOG_DEBUG("Done with send");
} }
} }
@ -377,7 +366,7 @@ void RadioLibInterface::handleReceiveInterrupt()
// when this is called, we should be in receive mode - if we are not, just jump out instead of bombing. Possible Race // when this is called, we should be in receive mode - if we are not, just jump out instead of bombing. Possible Race
// Condition? // Condition?
if (!isReceiving) { if (!isReceiving) {
LOG_ERROR("handleReceiveInterrupt called when not in receive mode, which shouldn't happen."); LOG_ERROR("handleReceiveInterrupt called when not in rx mode, which shouldn't happen");
return; return;
} }
@ -390,7 +379,7 @@ void RadioLibInterface::handleReceiveInterrupt()
#ifndef DISABLE_WELCOME_UNSET #ifndef DISABLE_WELCOME_UNSET
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) { if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
LOG_WARN("recv - lora rx disabled because RegionCode_Unset"); LOG_WARN("lora rx disabled: Region unset");
airTime->logAirtime(RX_ALL_LOG, xmitMsec); airTime->logAirtime(RX_ALL_LOG, xmitMsec);
return; return;
} }
@ -505,4 +494,4 @@ void RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
// bits // bits
enableInterrupt(isrTxLevel0); enableInterrupt(isrTxLevel0);
} }
} }

Wyświetl plik

@ -143,7 +143,7 @@ void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFro
void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p) void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p)
{ {
LOG_ERROR("Error=%d, returning NAK and dropping packet.", err); LOG_ERROR("Error=%d, returning NAK and dropping packet", err);
sendAckNak(err, getFrom(p), p->id, p->channel); sendAckNak(err, getFrom(p), p->id, p->channel);
packetPool.release(p); packetPool.release(p);
} }
@ -218,13 +218,13 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
if (hourlyTxPercent > myRegion->dutyCycle) { if (hourlyTxPercent > myRegion->dutyCycle) {
#ifdef DEBUG_PORT #ifdef DEBUG_PORT
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle); uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.", silentMinutes); LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d mins", silentMinutes);
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed(); meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->has_reply_id = true; cn->has_reply_id = true;
cn->reply_id = p->id; cn->reply_id = p->id;
cn->level = meshtastic_LogRecord_Level_WARNING; cn->level = meshtastic_LogRecord_Level_WARNING;
cn->time = getValidTime(RTCQualityFromNet); cn->time = getValidTime(RTCQualityFromNet);
sprintf(cn->message, "Duty cycle limit exceeded. You can send again in %d minutes.", silentMinutes); sprintf(cn->message, "Duty cycle limit exceeded. You can send again in %d mins", silentMinutes);
service->sendClientNotification(cn); service->sendClientNotification(cn);
#endif #endif
meshtastic_Routing_Error err = meshtastic_Routing_Error_DUTY_CYCLE_LIMIT; meshtastic_Routing_Error err = meshtastic_Routing_Error_DUTY_CYCLE_LIMIT;
@ -462,13 +462,13 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
// If the compressed length is greater than or equal to the original size, don't use the compressed form // If the compressed length is greater than or equal to the original size, don't use the compressed form
if (compressed_len >= p->decoded.payload.size) { if (compressed_len >= p->decoded.payload.size) {
LOG_DEBUG("Not using compressing message."); LOG_DEBUG("Not using compressing message");
// Set the uncompressed payload variant anyway. Shouldn't hurt? // Set the uncompressed payload variant anyway. Shouldn't hurt?
// p->decoded.which_payloadVariant = Data_payload_tag; // p->decoded.which_payloadVariant = Data_payload_tag;
// Otherwise we use the compressor // Otherwise we use the compressor
} else { } else {
LOG_DEBUG("Using compressed message."); LOG_DEBUG("Using compressed message");
// Copy the compressed data into the meshpacket // Copy the compressed data into the meshpacket
p->decoded.payload.size = compressed_len; p->decoded.payload.size = compressed_len;
@ -671,4 +671,4 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
// cache/learn of the existence of nodes (i.e. FloodRouter) that they should not // cache/learn of the existence of nodes (i.e. FloodRouter) that they should not
handleReceived(p); handleReceived(p);
packetPool.release(p); packetPool.release(p);
} }

Wyświetl plik

@ -69,13 +69,13 @@ static void taskCreateCert(void *parameter)
#if 0 #if 0
// Delete the saved certs (used in debugging) // Delete the saved certs (used in debugging)
LOG_DEBUG("Deleting any saved SSL keys ..."); LOG_DEBUG("Deleting any saved SSL keys");
// prefs.clear(); // prefs.clear();
prefs.remove("PK"); prefs.remove("PK");
prefs.remove("cert"); prefs.remove("cert");
#endif #endif
LOG_INFO("Checking if we have a previously saved SSL Certificate."); LOG_INFO("Checking if we have a saved SSL Certificate");
size_t pkLen = prefs.getBytesLength("PK"); size_t pkLen = prefs.getBytesLength("PK");
size_t certLen = prefs.getBytesLength("cert"); size_t certLen = prefs.getBytesLength("cert");
@ -139,7 +139,7 @@ void createSSLCert()
16, /* Priority of the task. */ 16, /* Priority of the task. */
NULL); /* Task handle. */ NULL); /* Task handle. */
LOG_DEBUG("Waiting for SSL Cert to be generated."); LOG_DEBUG("Waiting for SSL Cert to be generated");
while (!isCertReady) { while (!isCertReady) {
if ((millis() / 500) % 2) { if ((millis() / 500) % 2) {
if (runLoop) { if (runLoop) {
@ -189,7 +189,7 @@ int32_t WebServerThread::runOnce()
void initWebServer() void initWebServer()
{ {
LOG_DEBUG("Initializing Web Server ..."); LOG_DEBUG("Initializing Web Server...");
// We can now use the new certificate to setup our server as usual. // We can now use the new certificate to setup our server as usual.
secureServer = new HTTPSServer(cert); secureServer = new HTTPSServer(cert);
@ -210,4 +210,4 @@ void initWebServer()
LOG_ERROR("Web Servers Failed! ;-( "); LOG_ERROR("Web Servers Failed! ;-( ");
} }
} }
#endif #endif

Wyświetl plik

@ -403,19 +403,19 @@ int PiWebServerThread::CreateSSLCertificate()
X509 *x509 = NULL; X509 *x509 = NULL;
if (generate_rsa_key(&pkey) != 0) { if (generate_rsa_key(&pkey) != 0) {
LOG_ERROR("Error generating RSA-Key."); LOG_ERROR("Error generating RSA-Key");
return 1; return 1;
} }
if (generate_self_signed_x509(pkey, &x509) != 0) { if (generate_self_signed_x509(pkey, &x509) != 0) {
LOG_ERROR("Error generating of X509-Certificat."); LOG_ERROR("Error generating X509-Cert");
return 2; return 2;
} }
// Ope file to write private key file // Ope file to write private key file
FILE *pkey_file = fopen("private_key.pem", "wb"); FILE *pkey_file = fopen("private_key.pem", "wb");
if (!pkey_file) { if (!pkey_file) {
LOG_ERROR("Error opening private key file."); LOG_ERROR("Error opening private key file");
return 3; return 3;
} }
// write private key file // write private key file
@ -425,7 +425,7 @@ int PiWebServerThread::CreateSSLCertificate()
// open Certificate file // open Certificate file
FILE *x509_file = fopen("certificate.pem", "wb"); FILE *x509_file = fopen("certificate.pem", "wb");
if (!x509_file) { if (!x509_file) {
LOG_ERROR("Error opening certificate."); LOG_ERROR("Error opening cert");
return 4; return 4;
} }
// write cirtificate // write cirtificate
@ -434,7 +434,7 @@ int PiWebServerThread::CreateSSLCertificate()
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
X509_free(x509); X509_free(x509);
LOG_INFO("Create SSL Certifictate -certificate.pem- succesfull "); LOG_INFO("Create SSL Cert -certificate.pem- succesfull ");
return 0; return 0;
} }
@ -453,9 +453,9 @@ PiWebServerThread::PiWebServerThread()
if (settingsMap[webserverport] != 0) { if (settingsMap[webserverport] != 0) {
webservport = settingsMap[webserverport]; webservport = settingsMap[webserverport];
LOG_INFO("Using webserver port from yaml config. %i ", webservport); LOG_INFO("Using webserver port from yaml config %i ", webservport);
} else { } else {
LOG_INFO("Webserver port in yaml config set to 0, so defaulting to port 443."); LOG_INFO("Webserver port in yaml config set to 0, defaulting to port 443");
webservport = 443; webservport = 443;
} }
@ -464,7 +464,7 @@ PiWebServerThread::PiWebServerThread()
LOG_ERROR("Webserver couldn't be started, abort execution"); LOG_ERROR("Webserver couldn't be started, abort execution");
} else { } else {
LOG_INFO("Webserver started ...."); LOG_INFO("Webserver started");
u_map_init(&configWeb.mime_types); u_map_init(&configWeb.mime_types);
u_map_put(&configWeb.mime_types, "*", "application/octet-stream"); u_map_put(&configWeb.mime_types, "*", "application/octet-stream");
u_map_put(&configWeb.mime_types, ".html", "text/html"); u_map_put(&configWeb.mime_types, ".html", "text/html");
@ -527,4 +527,4 @@ PiWebServerThread::~PiWebServerThread()
} }
#endif #endif
#endif #endif

Wyświetl plik

@ -77,12 +77,12 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
LOG_DEBUG("Allowing admin response message"); LOG_DEBUG("Allowing admin response message");
} else if (mp.from == 0) { } else if (mp.from == 0) {
if (config.security.is_managed) { if (config.security.is_managed) {
LOG_INFO("Ignoring local admin payload because is_managed."); LOG_INFO("Ignoring local admin payload because is_managed");
return handled; return handled;
} }
} else if (strcasecmp(ch->settings.name, Channels::adminChannel) == 0) { } else if (strcasecmp(ch->settings.name, Channels::adminChannel) == 0) {
if (!config.security.admin_channel_enabled) { if (!config.security.admin_channel_enabled) {
LOG_INFO("Ignoring admin channel, as legacy admin is disabled."); LOG_INFO("Ignoring admin channel, as legacy admin is disabled");
myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp); myReply = allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp);
return handled; return handled;
} }
@ -93,7 +93,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
memcmp(mp.public_key.bytes, config.security.admin_key[1].bytes, 32) == 0) || memcmp(mp.public_key.bytes, config.security.admin_key[1].bytes, 32) == 0) ||
(config.security.admin_key[2].size == 32 && (config.security.admin_key[2].size == 32 &&
memcmp(mp.public_key.bytes, config.security.admin_key[2].bytes, 32) == 0)) { memcmp(mp.public_key.bytes, config.security.admin_key[2].bytes, 32) == 0)) {
LOG_INFO("PKC admin payload with authorized sender key."); LOG_INFO("PKC admin payload with authorized sender key");
} else { } else {
myReply = allocErrorResponse(meshtastic_Routing_Error_ADMIN_PUBLIC_KEY_UNAUTHORIZED, &mp); myReply = allocErrorResponse(meshtastic_Routing_Error_ADMIN_PUBLIC_KEY_UNAUTHORIZED, &mp);
LOG_INFO("Received PKC admin payload, but the sender public key does not match the admin authorized key!"); LOG_INFO("Received PKC admin payload, but the sender public key does not match the admin authorized key!");
@ -216,7 +216,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
disableBluetooth(); disableBluetooth();
LOG_INFO("Initiating factory config reset"); LOG_INFO("Initiating factory config reset");
nodeDB->factoryReset(); nodeDB->factoryReset();
LOG_INFO("Factory config reset finished, rebooting soon."); LOG_INFO("Factory config reset finished, rebooting soon");
reboot(DEFAULT_REBOOT_SECONDS); reboot(DEFAULT_REBOOT_SECONDS);
break; break;
} }
@ -252,7 +252,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_get_module_config_response_tag: { case meshtastic_AdminMessage_get_module_config_response_tag: {
LOG_INFO("Client is receiving a get_module_config response."); LOG_INFO("Client is receiving a get_module_config response");
if (fromOthers && r->get_module_config_response.which_payload_variant == if (fromOthers && r->get_module_config_response.which_payload_variant ==
meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG) { meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG) {
handleGetModuleConfigResponse(mp, r); handleGetModuleConfigResponse(mp, r);
@ -260,13 +260,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_remove_by_nodenum_tag: { case meshtastic_AdminMessage_remove_by_nodenum_tag: {
LOG_INFO("Client is receiving a remove_nodenum command."); LOG_INFO("Client is receiving a remove_nodenum command");
nodeDB->removeNodeByNum(r->remove_by_nodenum); nodeDB->removeNodeByNum(r->remove_by_nodenum);
this->notifyObservers(r); // Observed by screen this->notifyObservers(r); // Observed by screen
break; break;
} }
case meshtastic_AdminMessage_set_favorite_node_tag: { case meshtastic_AdminMessage_set_favorite_node_tag: {
LOG_INFO("Client is receiving a set_favorite_node command."); LOG_INFO("Client is receiving a set_favorite_node command");
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node);
if (node != NULL) { if (node != NULL) {
node->is_favorite = true; node->is_favorite = true;
@ -275,7 +275,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_remove_favorite_node_tag: { case meshtastic_AdminMessage_remove_favorite_node_tag: {
LOG_INFO("Client is receiving a remove_favorite_node command."); LOG_INFO("Client is receiving a remove_favorite_node command");
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node);
if (node != NULL) { if (node != NULL) {
node->is_favorite = false; node->is_favorite = false;
@ -284,7 +284,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_set_fixed_position_tag: { case meshtastic_AdminMessage_set_fixed_position_tag: {
LOG_INFO("Client is receiving a set_fixed_position command."); LOG_INFO("Client is receiving a set_fixed_position command");
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum()); meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
node->has_position = true; node->has_position = true;
node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position); node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position);
@ -300,14 +300,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_remove_fixed_position_tag: { case meshtastic_AdminMessage_remove_fixed_position_tag: {
LOG_INFO("Client is receiving a remove_fixed_position command."); LOG_INFO("Client is receiving a remove_fixed_position command");
nodeDB->clearLocalPosition(); nodeDB->clearLocalPosition();
config.position.fixed_position = false; config.position.fixed_position = false;
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false); saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
break; break;
} }
case meshtastic_AdminMessage_set_time_only_tag: { case meshtastic_AdminMessage_set_time_only_tag: {
LOG_INFO("Client is receiving a set_time_only command."); LOG_INFO("Client is receiving a set_time_only command");
struct timeval tv; struct timeval tv;
tv.tv_sec = r->set_time_only; tv.tv_sec = r->set_time_only;
tv.tv_usec = 0; tv.tv_usec = 0;
@ -316,7 +316,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
break; break;
} }
case meshtastic_AdminMessage_enter_dfu_mode_request_tag: { case meshtastic_AdminMessage_enter_dfu_mode_request_tag: {
LOG_INFO("Client is requesting to enter DFU mode."); LOG_INFO("Client is requesting to enter DFU mode");
#if defined(ARCH_NRF52) || defined(ARCH_RP2040) #if defined(ARCH_NRF52) || defined(ARCH_RP2040)
enterDfuMode(); enterDfuMode();
#endif #endif
@ -1096,4 +1096,4 @@ void disableBluetooth()
nrf52Bluetooth->shutdown(); nrf52Bluetooth->shutdown();
#endif #endif
#endif #endif
} }

Wyświetl plik

@ -481,7 +481,7 @@ int32_t CannedMessageModule::runOnce()
} }
this->runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE; this->runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE;
} else { } else {
// LOG_DEBUG("Reset message is empty."); // LOG_DEBUG("Reset message is empty");
this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE; this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
} }
} }
@ -1256,4 +1256,4 @@ String CannedMessageModule::drawWithCursor(String text, int cursor)
return result; return result;
} }
#endif #endif

Wyświetl plik

@ -65,16 +65,16 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply()
{ {
if (!airTime->isTxAllowedChannelUtil(false)) { if (!airTime->isTxAllowedChannelUtil(false)) {
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
LOG_DEBUG("Skip sending NodeInfo due to > 40 percent channel util."); LOG_DEBUG("Skip sending NodeInfo due to > 40 percent chan util");
return NULL; return NULL;
} }
// If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway. // If we sent our NodeInfo less than 5 min. ago, don't send it again as it may be still underway.
if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) { if (!shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 5 * 60 * 1000)) {
LOG_DEBUG("Skip sending NodeInfo since we just sent it less than 5 minutes ago."); LOG_DEBUG("Skip sending NodeInfo since we sent it <5 mins ago.");
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
return NULL; return NULL;
} else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) { } else if (shorterTimeout && lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 60 * 1000)) {
LOG_DEBUG("Skip sending actively requested NodeInfo since we just sent it less than 60 seconds ago."); LOG_DEBUG("Skip sending requested NodeInfo since we sent it <60s ago.");
ignoreRequest = true; // Mark it as ignored for MeshModule ignoreRequest = true; // Mark it as ignored for MeshModule
return NULL; return NULL;
} else { } else {
@ -112,4 +112,4 @@ int32_t NodeInfoModule::runOnce()
sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies) sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies)
} }
return Default::getConfiguredOrDefaultMs(config.device.node_info_broadcast_secs, default_node_info_broadcast_secs); return Default::getConfiguredOrDefaultMs(config.device.node_info_broadcast_secs, default_node_info_broadcast_secs);
} }

Wyświetl plik

@ -351,7 +351,7 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha
if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER, if (IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_TRACKER,
meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) && meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) &&
config.power.is_power_saving) { config.power.is_power_saving) {
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep."); LOG_DEBUG("Starting next execution in 5s, then going to sleep");
sleepOnNextExecution = true; sleepOnNextExecution = true;
setIntervalFromNow(5000); setIntervalFromNow(5000);
} }
@ -364,7 +364,7 @@ int32_t PositionModule::runOnce()
if (sleepOnNextExecution == true) { if (sleepOnNextExecution == true) {
sleepOnNextExecution = false; sleepOnNextExecution = false;
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs); uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(config.position.position_broadcast_secs);
LOG_DEBUG("Sleeping for %ims, then awaking to send position again.", nightyNightMs); LOG_DEBUG("Sleeping for %ims, then awaking to send position again", nightyNightMs);
doDeepSleep(nightyNightMs, false); doDeepSleep(nightyNightMs, false);
} }
@ -449,23 +449,6 @@ struct SmartPosition PositionModule::getDistanceTraveledSinceLastSend(meshtastic
float distanceTraveledSinceLastSend = GeoCoord::latLongToMeter( float distanceTraveledSinceLastSend = GeoCoord::latLongToMeter(
lastGpsLatitude * 1e-7, lastGpsLongitude * 1e-7, currentPosition.latitude_i * 1e-7, currentPosition.longitude_i * 1e-7); lastGpsLatitude * 1e-7, lastGpsLongitude * 1e-7, currentPosition.latitude_i * 1e-7, currentPosition.longitude_i * 1e-7);
#ifdef GPS_EXTRAVERBOSE
LOG_DEBUG("--------LAST POSITION------------------------------------");
LOG_DEBUG("lastGpsLatitude=%i, lastGpsLatitude=%i", lastGpsLatitude, lastGpsLongitude);
LOG_DEBUG("--------CURRENT POSITION---------------------------------");
LOG_DEBUG("currentPosition.latitude_i=%i, currentPosition.longitude_i=%i", lastGpsLatitude, lastGpsLongitude);
LOG_DEBUG("--------SMART POSITION-----------------------------------");
LOG_DEBUG("hasTraveledOverThreshold=%i, distanceTraveled=%f, distanceThreshold=%f",
abs(distanceTraveledSinceLastSend) >= distanceTravelThreshold, abs(distanceTraveledSinceLastSend),
distanceTravelThreshold);
if (abs(distanceTraveledSinceLastSend) >= distanceTravelThreshold) {
LOG_DEBUG("SMART SEEEEEEEEENDING");
}
#endif
return SmartPosition{.distanceTraveled = abs(distanceTraveledSinceLastSend), return SmartPosition{.distanceTraveled = abs(distanceTraveledSinceLastSend),
.distanceThreshold = distanceTravelThreshold, .distanceThreshold = distanceTravelThreshold,
.hasTraveledOverThreshold = abs(distanceTraveledSinceLastSend) >= distanceTravelThreshold}; .hasTraveledOverThreshold = abs(distanceTraveledSinceLastSend) >= distanceTravelThreshold};
@ -495,4 +478,4 @@ void PositionModule::handleNewPosition()
} }
} }
#endif #endif

Wyświetl plik

@ -215,7 +215,7 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
} }
if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) { if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) {
LOG_DEBUG("Filesystem doesn't have enough free space. Aborting write."); LOG_DEBUG("Filesystem doesn't have enough free space. Aborting write");
return 0; return 0;
} }
@ -292,4 +292,4 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp)
#endif #endif
return 1; return 1;
} }

Wyświetl plik

@ -187,7 +187,7 @@ void StoreForwardModule::historyAdd(const meshtastic_MeshPacket &mp)
const auto &p = mp.decoded; const auto &p = mp.decoded;
if (this->packetHistoryTotalCount == this->records) { if (this->packetHistoryTotalCount == this->records) {
LOG_WARN("S&F - PSRAM Full. Starting overwrite."); LOG_WARN("S&F - PSRAM Full. Starting overwrite");
this->packetHistoryTotalCount = 0; this->packetHistoryTotalCount = 0;
for (auto &i : lastRequest) { for (auto &i : lastRequest) {
i.second = 0; // Clear the last request index for each client device i.second = 0; // Clear the last request index for each client device
@ -393,7 +393,7 @@ ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &m
} }
} else { } else {
storeForwardModule->historyAdd(mp); storeForwardModule->historyAdd(mp);
LOG_INFO("S&F stored. Message history contains %u records now.", this->packetHistoryTotalCount); LOG_INFO("S&F stored. Message history contains %u records now", this->packetHistoryTotalCount);
} }
} else if (!isFromUs(&mp) && mp.decoded.portnum == meshtastic_PortNum_STORE_FORWARD_APP) { } else if (!isFromUs(&mp) && mp.decoded.portnum == meshtastic_PortNum_STORE_FORWARD_APP) {
auto &p = mp.decoded; auto &p = mp.decoded;
@ -482,7 +482,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
LOG_INFO("Client Request to send STATS"); LOG_INFO("Client Request to send STATS");
if (this->busy) { if (this->busy) {
storeForwardModule->sendMessage(getFrom(&mp), meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY); storeForwardModule->sendMessage(getFrom(&mp), meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY);
LOG_INFO("S&F - Busy. Try again shortly."); LOG_INFO("S&F - Busy. Try again shortly");
} else { } else {
storeForwardModule->statsSend(getFrom(&mp)); storeForwardModule->statsSend(getFrom(&mp));
} }
@ -602,10 +602,10 @@ StoreForwardModule::StoreForwardModule()
is_server = true; is_server = true;
} else { } else {
LOG_INFO("."); LOG_INFO(".");
LOG_INFO("S&F: not enough PSRAM free, disabling."); LOG_INFO("S&F: not enough PSRAM free, disabling");
} }
} else { } else {
LOG_INFO("S&F: device doesn't have PSRAM, disabling."); LOG_INFO("S&F: device doesn't have PSRAM, disabling");
} }
// Client // Client
@ -617,4 +617,4 @@ StoreForwardModule::StoreForwardModule()
disable(); disable();
} }
#endif #endif
} }

Wyświetl plik

@ -73,7 +73,7 @@ int32_t EnvironmentTelemetryModule::runOnce()
sleepOnNextExecution = false; sleepOnNextExecution = false;
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval, uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.environment_update_interval,
default_telemetry_broadcast_interval_secs); default_telemetry_broadcast_interval_secs);
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.", nightyNightMs); LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs);
doDeepSleep(nightyNightMs, true); doDeepSleep(nightyNightMs, true);
} }
@ -463,7 +463,7 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
service->sendToMesh(p, RX_SRC_LOCAL, true); service->sendToMesh(p, RX_SRC_LOCAL, true);
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep."); LOG_DEBUG("Starting next execution in 5s, then going to sleep");
sleepOnNextExecution = true; sleepOnNextExecution = true;
setIntervalFromNow(5000); setIntervalFromNow(5000);
} }
@ -586,4 +586,4 @@ AdminMessageHandleResult EnvironmentTelemetryModule::handleAdminMessageForModule
return result; return result;
} }
#endif #endif

Wyświetl plik

@ -39,7 +39,7 @@ int32_t HealthTelemetryModule::runOnce()
sleepOnNextExecution = false; sleepOnNextExecution = false;
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.health_update_interval, uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.health_update_interval,
default_telemetry_broadcast_interval_secs); default_telemetry_broadcast_interval_secs);
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.", nightyNightMs); LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs);
doDeepSleep(nightyNightMs, true); doDeepSleep(nightyNightMs, true);
} }
@ -236,7 +236,7 @@ bool HealthTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
service->sendToMesh(p, RX_SRC_LOCAL, true); service->sendToMesh(p, RX_SRC_LOCAL, true);
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
LOG_DEBUG("Starting next execution in 5 seconds and then going to sleep."); LOG_DEBUG("Starting next execution in 5s, then going to sleep");
sleepOnNextExecution = true; sleepOnNextExecution = true;
setIntervalFromNow(5000); setIntervalFromNow(5000);
} }

Wyświetl plik

@ -27,7 +27,7 @@ int32_t PowerTelemetryModule::runOnce()
sleepOnNextExecution = false; sleepOnNextExecution = false;
uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.power_update_interval, uint32_t nightyNightMs = Default::getConfiguredOrDefaultMs(moduleConfig.telemetry.power_update_interval,
default_telemetry_broadcast_interval_secs); default_telemetry_broadcast_interval_secs);
LOG_DEBUG("Sleeping for %ims, then awaking to send metrics again.", nightyNightMs); LOG_DEBUG("Sleeping for %ims, then waking to send metrics again", nightyNightMs);
doDeepSleep(nightyNightMs, true); doDeepSleep(nightyNightMs, true);
} }
@ -243,7 +243,7 @@ bool PowerTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly)
service->sendToMesh(p, RX_SRC_LOCAL, true); service->sendToMesh(p, RX_SRC_LOCAL, true);
if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) { if (config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR && config.power.is_power_saving) {
LOG_DEBUG("Starting next execution in 5s then going to sleep."); LOG_DEBUG("Starting next execution in 5s then going to sleep");
sleepOnNextExecution = true; sleepOnNextExecution = true;
setIntervalFromNow(5000); setIntervalFromNow(5000);
} }

Wyświetl plik

@ -80,9 +80,9 @@ void BME680Sensor::loadState()
file.read((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE); file.read((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE);
file.close(); file.close();
bme680.setState(bsecState); bme680.setState(bsecState);
LOG_INFO("%s state read from %s.", sensorName, bsecConfigFileName); LOG_INFO("%s state read from %s", sensorName, bsecConfigFileName);
} else { } else {
LOG_INFO("No %s state found (File: %s).", sensorName, bsecConfigFileName); LOG_INFO("No %s state found (File: %s)", sensorName, bsecConfigFileName);
} }
#else #else
LOG_ERROR("ERROR: Filesystem not implemented"); LOG_ERROR("ERROR: Filesystem not implemented");
@ -119,12 +119,12 @@ void BME680Sensor::updateState()
} }
auto file = FSCom.open(bsecConfigFileName, FILE_O_WRITE); auto file = FSCom.open(bsecConfigFileName, FILE_O_WRITE);
if (file) { if (file) {
LOG_INFO("%s state write to %s.", sensorName, bsecConfigFileName); LOG_INFO("%s state write to %s", sensorName, bsecConfigFileName);
file.write((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE); file.write((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE);
file.flush(); file.flush();
file.close(); file.close();
} else { } else {
LOG_INFO("Can't write %s state (File: %s).", sensorName, bsecConfigFileName); LOG_INFO("Can't write %s state (File: %s)", sensorName, bsecConfigFileName);
} }
} }
#else #else
@ -145,4 +145,4 @@ void BME680Sensor::checkStatus(String functionName)
LOG_WARN("%s BME68X code: %s", functionName.c_str(), String(bme680.sensor.status).c_str()); LOG_WARN("%s BME68X code: %s", functionName.c_str(), String(bme680.sensor.status).c_str());
} }
#endif #endif

Wyświetl plik

@ -19,7 +19,7 @@ int32_t MLX90614Sensor::runOnce()
LOG_DEBUG("MLX90614 emissivity: %f", mlx.readEmissivity()); LOG_DEBUG("MLX90614 emissivity: %f", mlx.readEmissivity());
if (fabs(MLX90614_EMISSIVITY - mlx.readEmissivity()) > 0.001) { if (fabs(MLX90614_EMISSIVITY - mlx.readEmissivity()) > 0.001) {
mlx.writeEmissivity(MLX90614_EMISSIVITY); mlx.writeEmissivity(MLX90614_EMISSIVITY);
LOG_INFO("MLX90614 emissivity updated. In case of weird data, power cycle."); LOG_INFO("MLX90614 emissivity updated. In case of weird data, power cycle");
} }
LOG_DEBUG("MLX90614 Init Succeed"); LOG_DEBUG("MLX90614 Init Succeed");
status = true; status = true;

Wyświetl plik

@ -103,7 +103,7 @@ bool NAU7802Sensor::saveCalibrationData()
nau7802config.calibrationFactor = nau7802.getCalibrationFactor(); nau7802config.calibrationFactor = nau7802.getCalibrationFactor();
bool okay = false; bool okay = false;
LOG_INFO("%s state write to %s.", sensorName, nau7802ConfigFileName); LOG_INFO("%s state write to %s", sensorName, nau7802ConfigFileName);
pb_ostream_t stream = {&writecb, static_cast<Print *>(&file), meshtastic_Nau7802Config_size}; pb_ostream_t stream = {&writecb, static_cast<Print *>(&file), meshtastic_Nau7802Config_size};
if (!pb_encode(&stream, &meshtastic_Nau7802Config_msg, &nau7802config)) { if (!pb_encode(&stream, &meshtastic_Nau7802Config_msg, &nau7802config)) {
@ -121,7 +121,7 @@ bool NAU7802Sensor::loadCalibrationData()
auto file = FSCom.open(nau7802ConfigFileName, FILE_O_READ); auto file = FSCom.open(nau7802ConfigFileName, FILE_O_READ);
bool okay = false; bool okay = false;
if (file) { if (file) {
LOG_INFO("%s state read from %s.", sensorName, nau7802ConfigFileName); LOG_INFO("%s state read from %s", sensorName, nau7802ConfigFileName);
pb_istream_t stream = {&readcb, &file, meshtastic_Nau7802Config_size}; pb_istream_t stream = {&readcb, &file, meshtastic_Nau7802Config_size};
if (!pb_decode(&stream, &meshtastic_Nau7802Config_msg, &nau7802config)) { if (!pb_decode(&stream, &meshtastic_Nau7802Config_msg, &nau7802config)) {
LOG_ERROR("Error: can't decode protobuf %s", PB_GET_ERROR(&stream)); LOG_ERROR("Error: can't decode protobuf %s", PB_GET_ERROR(&stream));
@ -132,9 +132,9 @@ bool NAU7802Sensor::loadCalibrationData()
} }
file.close(); file.close();
} else { } else {
LOG_INFO("No %s state found (File: %s).", sensorName, nau7802ConfigFileName); LOG_INFO("No %s state found (File: %s)", sensorName, nau7802ConfigFileName);
} }
return okay; return okay;
} }
#endif #endif

Wyświetl plik

@ -122,13 +122,13 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
&meshtastic_Position_msg, &pos); // make the Data protobuf from position &meshtastic_Position_msg, &pos); // make the Data protobuf from position
service->sendToMesh(p, RX_SRC_LOCAL); service->sendToMesh(p, RX_SRC_LOCAL);
} else { } else {
LOG_DEBUG("JSON Ignoring downlink message with unsupported type."); LOG_DEBUG("JSON Ignoring downlink message with unsupported type");
} }
} else { } else {
LOG_ERROR("JSON Received payload on MQTT but not a valid envelope."); LOG_ERROR("JSON Received payload on MQTT but not a valid envelope");
} }
} else { } else {
LOG_WARN("JSON downlink received on channel not called 'mqtt' or without downlink enabled."); LOG_WARN("JSON downlink received on channel not called 'mqtt' or without downlink enabled");
} }
} else { } else {
// no json, this is an invalid payload // no json, this is an invalid payload
@ -155,7 +155,7 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
if (e.packet && isFromUs(e.packet)) if (e.packet && isFromUs(e.packet))
routingModule->sendAckNak(meshtastic_Routing_Error_NONE, getFrom(e.packet), e.packet->id, ch.index); routingModule->sendAckNak(meshtastic_Routing_Error_NONE, getFrom(e.packet), e.packet->id, ch.index);
else else
LOG_INFO("Ignoring downlink message we originally sent."); LOG_INFO("Ignoring downlink message we originally sent");
} else { } else {
// Find channel by channel_id and check downlink_enabled // Find channel by channel_id and check downlink_enabled
if ((strcmp(e.channel_id, "PKI") == 0 && e.packet) || if ((strcmp(e.channel_id, "PKI") == 0 && e.packet) ||
@ -165,18 +165,18 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
p->via_mqtt = true; // Mark that the packet was received via MQTT p->via_mqtt = true; // Mark that the packet was received via MQTT
if (isFromUs(p)) { if (isFromUs(p)) {
LOG_INFO("Ignoring downlink message we originally sent."); LOG_INFO("Ignoring downlink message we originally sent");
packetPool.release(p); packetPool.release(p);
return; return;
} }
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
if (moduleConfig.mqtt.encryption_enabled) { if (moduleConfig.mqtt.encryption_enabled) {
LOG_INFO("Ignoring decoded message on MQTT, encryption is enabled."); LOG_INFO("Ignoring decoded message on MQTT, encryption is enabled");
packetPool.release(p); packetPool.release(p);
return; return;
} }
if (p->decoded.portnum == meshtastic_PortNum_ADMIN_APP) { if (p->decoded.portnum == meshtastic_PortNum_ADMIN_APP) {
LOG_INFO("Ignoring decoded admin packet."); LOG_INFO("Ignoring decoded admin packet");
packetPool.release(p); packetPool.release(p);
return; return;
} }
@ -242,7 +242,7 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE)
isMqttServerAddressPrivate = isPrivateIpAddress(moduleConfig.mqtt.address); isMqttServerAddressPrivate = isPrivateIpAddress(moduleConfig.mqtt.address);
if (isMqttServerAddressPrivate) { if (isMqttServerAddressPrivate) {
LOG_INFO("MQTT server is a private IP address."); LOG_INFO("MQTT server on a private IP");
} }
#if HAS_NETWORKING #if HAS_NETWORKING
@ -251,7 +251,7 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE)
#endif #endif
if (moduleConfig.mqtt.proxy_to_client_enabled) { if (moduleConfig.mqtt.proxy_to_client_enabled) {
LOG_INFO("MQTT configured to use client proxy..."); LOG_INFO("MQTT configured to use client proxy");
enabled = true; enabled = true;
runASAP = true; runASAP = true;
reconnectCount = 0; reconnectCount = 0;
@ -315,7 +315,7 @@ void MQTT::reconnect()
{ {
if (wantsLink()) { if (wantsLink()) {
if (moduleConfig.mqtt.proxy_to_client_enabled) { if (moduleConfig.mqtt.proxy_to_client_enabled) {
LOG_INFO("MQTT connecting via client proxy instead..."); LOG_INFO("MQTT connecting via client proxy instead");
enabled = true; enabled = true;
runASAP = true; runASAP = true;
reconnectCount = 0; reconnectCount = 0;
@ -385,7 +385,7 @@ void MQTT::reconnect()
} else { } else {
#if HAS_WIFI && !defined(ARCH_PORTDUINO) #if HAS_WIFI && !defined(ARCH_PORTDUINO)
reconnectCount++; reconnectCount++;
LOG_ERROR("Failed to contact MQTT server directly (%d/%d)...", reconnectCount, reconnectMax); LOG_ERROR("Failed to contact MQTT server directly (%d/%d)", reconnectCount, reconnectMax);
if (reconnectCount >= reconnectMax) { if (reconnectCount >= reconnectMax) {
needReconnect = true; needReconnect = true;
wifiReconnect->setIntervalFromNow(0); wifiReconnect->setIntervalFromNow(0);
@ -630,9 +630,9 @@ void MQTT::perhapsReportToMap()
if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) {
last_report_to_map = millis(); last_report_to_map = millis();
if (map_position_precision == 0) if (map_position_precision == 0)
LOG_WARN("MQTT Map reporting is enabled, but precision is 0"); LOG_WARN("MQTT Map reporting enabled, but precision is 0");
if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)
LOG_WARN("MQTT Map reporting is enabled, but no position available."); LOG_WARN("MQTT Map reporting enabled, but no position available");
return; return;
} }
@ -768,4 +768,4 @@ bool MQTT::isPrivateIpAddress(const char address[])
int octet2Num = atoi(octet2); int octet2Num = atoi(octet2);
return octet2Num >= 16 && octet2Num <= 31; return octet2Num >= 16 && octet2Num <= 31;
} }

Wyświetl plik

@ -309,4 +309,4 @@ void enterDfuMode()
#else #else
enterUf2Dfu(); enterUf2Dfu();
#endif #endif
} }

Wyświetl plik

@ -22,7 +22,7 @@ ErrorCode SimRadio::send(meshtastic_MeshPacket *p)
// set (random) transmit delay to let others reconfigure their radio, // set (random) transmit delay to let others reconfigure their radio,
// to avoid collisions and implement timing-based flooding // to avoid collisions and implement timing-based flooding
LOG_DEBUG("Set random delay before transmitting."); LOG_DEBUG("Set random delay before tx");
setTransmitDelay(); setTransmitDelay();
return res; return res;
} }
@ -193,7 +193,7 @@ void SimRadio::startSend(meshtastic_MeshPacket *txp)
memcpy(&c.data.bytes, p->decoded.payload.bytes, p->decoded.payload.size); memcpy(&c.data.bytes, p->decoded.payload.bytes, p->decoded.payload.size);
c.data.size = p->decoded.payload.size; c.data.size = p->decoded.payload.size;
} else { } else {
LOG_WARN("Payload size is larger than compressed message allows! Sending empty payload."); LOG_WARN("Payload size larger than compressed message allows! Sending empty payload");
} }
p->decoded.payload.size = p->decoded.payload.size =
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Compressed_msg, &c); pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Compressed_msg, &c);
@ -265,4 +265,4 @@ int16_t SimRadio::readData(uint8_t *data, size_t len)
} }
return state; return state;
} }

Wyświetl plik

@ -71,7 +71,7 @@ void setCPUFast(bool on)
* (Added: Dec 23, 2021 by Jm Casler) * (Added: Dec 23, 2021 by Jm Casler)
*/ */
#ifndef CONFIG_IDF_TARGET_ESP32C3 #ifndef CONFIG_IDF_TARGET_ESP32C3
LOG_DEBUG("Setting CPU to 240MHz because WiFi is in use."); LOG_DEBUG("Setting CPU to 240MHz because WiFi is in use");
setCpuFrequencyMhz(240); setCpuFrequencyMhz(240);
#endif #endif
return; return;
@ -305,7 +305,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
PMU->disablePowerOutput(XPOWERS_LDO2); // lora radio power channel PMU->disablePowerOutput(XPOWERS_LDO2); // lora radio power channel
} }
if (msecToWake == portMAX_DELAY) { if (msecToWake == portMAX_DELAY) {
LOG_INFO("PMU shutdown."); LOG_INFO("PMU shutdown");
console->flush(); console->flush();
PMU->shutdown(); PMU->shutdown();
} }
@ -512,4 +512,4 @@ void enableLoraInterrupt()
} }
#endif #endif
} }
#endif #endif

Wyświetl plik

@ -97,7 +97,7 @@ void XModemAdapter::sendControl(meshtastic_XModem_Control c)
{ {
xmodemStore = meshtastic_XModem_init_zero; xmodemStore = meshtastic_XModem_init_zero;
xmodemStore.control = c; xmodemStore.control = c;
LOG_DEBUG("XModem: Notify Sending control %d.", c); LOG_DEBUG("XModem: Notify Sending control %d", c);
packetReady.notifyObservers(packetno); packetReady.notifyObservers(packetno);
} }
@ -141,7 +141,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
xmodemStore.seq = packetno; xmodemStore.seq = packetno;
xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes));
xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size);
LOG_DEBUG("XModem: STX Notify Sending packet %d, %d Bytes.", packetno, xmodemStore.buffer.size); LOG_DEBUG("XModem: STX Notify Sending packet %d, %d Bytes", packetno, xmodemStore.buffer.size);
if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) {
isEOT = true; isEOT = true;
// send EOT on next Ack // send EOT on next Ack
@ -208,7 +208,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
xmodemStore.seq = packetno; xmodemStore.seq = packetno;
xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes));
xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size);
LOG_DEBUG("XModem: ACK Notify Sending packet %d, %d Bytes.", packetno, xmodemStore.buffer.size); LOG_DEBUG("XModem: ACK Notify Sending packet %d, %d Bytes", packetno, xmodemStore.buffer.size);
if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) {
isEOT = true; isEOT = true;
// send EOT on next Ack // send EOT on next Ack
@ -235,7 +235,7 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
file.seek((packetno - 1) * sizeof(meshtastic_XModem_buffer_t::bytes)); file.seek((packetno - 1) * sizeof(meshtastic_XModem_buffer_t::bytes));
xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes));
xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size);
LOG_DEBUG("XModem: NAK Notify Sending packet %d, %d Bytes.", packetno, xmodemStore.buffer.size); LOG_DEBUG("XModem: NAK Notify Sending packet %d, %d Bytes", packetno, xmodemStore.buffer.size);
if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) {
isEOT = true; isEOT = true;
// send EOT on next Ack // send EOT on next Ack
@ -251,4 +251,4 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
break; break;
} }
} }
#endif #endif

Wyświetl plik

@ -6,7 +6,6 @@
// Debugging // Debugging
// #define GPS_DEBUG // #define GPS_DEBUG
// #define GPS_EXTRAVERBOSE
// Lora // Lora
#define USE_LLCC68 // Original Chatter2 with LLCC68 module #define USE_LLCC68 // Original Chatter2 with LLCC68 module