mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-26 03:37:38 +00:00
remove newline from logging statements. (#5022)
remove newline from logging statements in code. The LOG_* functions will now magically add it at the end. --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -32,7 +32,7 @@ class ESP32CryptoEngine : public CryptoEngine
|
||||
sizeof(scratch) - numBytes); // Fill rest of buffer with zero (in case cypher looks at it)
|
||||
mbedtls_aes_crypt_ctr(&aes, numBytes, &nc_off, _nonce, stream_block, scratch, bytes);
|
||||
} else {
|
||||
LOG_ERROR("Packet too large for crypto engine: %d. noop encryption!\n", numBytes);
|
||||
LOG_ERROR("Packet too large for crypto engine: %d. noop encryption!", numBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void *SimpleAllocator::alloc(size_t size)
|
||||
assert(nextFree + size <= sizeof(bytes));
|
||||
void *res = &bytes[nextFree];
|
||||
nextFree += size;
|
||||
LOG_DEBUG("Total simple allocs %u\n", nextFree);
|
||||
LOG_DEBUG("Total simple allocs %u", nextFree);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -76,17 +76,17 @@ void enableSlowCLK()
|
||||
uint32_t cal_32k = CALIBRATE_ONE(RTC_CAL_32K_XTAL);
|
||||
|
||||
if (cal_32k == 0) {
|
||||
LOG_DEBUG("32K XTAL OSC has not started up\n");
|
||||
LOG_DEBUG("32K XTAL OSC has not started up");
|
||||
} else {
|
||||
rtc_clk_slow_freq_set(RTC_SLOW_FREQ_32K_XTAL);
|
||||
LOG_DEBUG("Switching RTC Source to 32.768Khz succeeded, using 32K XTAL\n");
|
||||
LOG_DEBUG("Switching RTC Source to 32.768Khz succeeded, using 32K XTAL");
|
||||
CALIBRATE_ONE(RTC_CAL_RTC_MUX);
|
||||
CALIBRATE_ONE(RTC_CAL_32K_XTAL);
|
||||
}
|
||||
CALIBRATE_ONE(RTC_CAL_RTC_MUX);
|
||||
CALIBRATE_ONE(RTC_CAL_32K_XTAL);
|
||||
if (rtc_clk_slow_freq_get() != RTC_SLOW_FREQ_32K_XTAL) {
|
||||
LOG_WARN("Failed to switch 32K XTAL RTC source to 32.768Khz !!! \n");
|
||||
LOG_WARN("Failed to switch 32K XTAL RTC source to 32.768Khz !!! ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -97,22 +97,22 @@ void esp32Setup()
|
||||
/* We explicitly don't want to do call randomSeed,
|
||||
// as that triggers the esp32 core to use a less secure pseudorandom function.
|
||||
uint32_t seed = esp_random();
|
||||
LOG_DEBUG("Setting random seed %u\n", seed);
|
||||
LOG_DEBUG("Setting random seed %u", seed);
|
||||
randomSeed(seed);
|
||||
*/
|
||||
|
||||
LOG_DEBUG("Total heap: %d\n", ESP.getHeapSize());
|
||||
LOG_DEBUG("Free heap: %d\n", ESP.getFreeHeap());
|
||||
LOG_DEBUG("Total PSRAM: %d\n", ESP.getPsramSize());
|
||||
LOG_DEBUG("Free PSRAM: %d\n", ESP.getFreePsram());
|
||||
LOG_DEBUG("Total heap: %d", ESP.getHeapSize());
|
||||
LOG_DEBUG("Free heap: %d", ESP.getFreeHeap());
|
||||
LOG_DEBUG("Total PSRAM: %d", ESP.getPsramSize());
|
||||
LOG_DEBUG("Free PSRAM: %d", ESP.getFreePsram());
|
||||
|
||||
nvs_stats_t nvs_stats;
|
||||
auto res = nvs_get_stats(NULL, &nvs_stats);
|
||||
assert(res == ESP_OK);
|
||||
LOG_DEBUG("NVS: UsedEntries %d, FreeEntries %d, AllEntries %d, NameSpaces %d\n", nvs_stats.used_entries,
|
||||
nvs_stats.free_entries, nvs_stats.total_entries, nvs_stats.namespace_count);
|
||||
LOG_DEBUG("NVS: UsedEntries %d, FreeEntries %d, AllEntries %d, NameSpaces %d", nvs_stats.used_entries, nvs_stats.free_entries,
|
||||
nvs_stats.total_entries, nvs_stats.namespace_count);
|
||||
|
||||
LOG_DEBUG("Setup Preferences in Flash Storage\n");
|
||||
LOG_DEBUG("Setup Preferences in Flash Storage");
|
||||
|
||||
// Create object to store our persistent data
|
||||
Preferences preferences;
|
||||
@@ -129,16 +129,16 @@ void esp32Setup()
|
||||
if (hwven != HW_VENDOR)
|
||||
preferences.putUInt("hwVendor", HW_VENDOR);
|
||||
preferences.end();
|
||||
LOG_DEBUG("Number of Device Reboots: %d\n", rebootCounter);
|
||||
LOG_DEBUG("Number of Device Reboots: %d", rebootCounter);
|
||||
#if !MESHTASTIC_EXCLUDE_BLUETOOTH
|
||||
String BLEOTA = BleOta::getOtaAppVersion();
|
||||
if (BLEOTA.isEmpty()) {
|
||||
LOG_INFO("No OTA firmware available\n");
|
||||
LOG_INFO("No OTA firmware available");
|
||||
} else {
|
||||
LOG_INFO("OTA firmware version %s\n", BLEOTA.c_str());
|
||||
LOG_INFO("OTA firmware version %s", BLEOTA.c_str());
|
||||
}
|
||||
#else
|
||||
LOG_INFO("No OTA firmware available\n");
|
||||
LOG_INFO("No OTA firmware available");
|
||||
#endif
|
||||
|
||||
// enableModemSleep();
|
||||
@@ -172,13 +172,13 @@ void esp32Setup()
|
||||
uint32_t axpDebugRead()
|
||||
{
|
||||
axp.debugCharging();
|
||||
LOG_DEBUG("vbus current %f\n", axp.getVbusCurrent());
|
||||
LOG_DEBUG("charge current %f\n", axp.getBattChargeCurrent());
|
||||
LOG_DEBUG("bat voltage %f\n", axp.getBattVoltage());
|
||||
LOG_DEBUG("batt pct %d\n", axp.getBattPercentage());
|
||||
LOG_DEBUG("is battery connected %d\n", axp.isBatteryConnect());
|
||||
LOG_DEBUG("is USB connected %d\n", axp.isVBUSPlug());
|
||||
LOG_DEBUG("is charging %d\n", axp.isChargeing());
|
||||
LOG_DEBUG("vbus current %f", axp.getVbusCurrent());
|
||||
LOG_DEBUG("charge current %f", axp.getBattChargeCurrent());
|
||||
LOG_DEBUG("bat voltage %f", axp.getBattVoltage());
|
||||
LOG_DEBUG("batt pct %d", axp.getBattPercentage());
|
||||
LOG_DEBUG("is battery connected %d", axp.isBatteryConnect());
|
||||
LOG_DEBUG("is USB connected %d", axp.isVBUSPlug());
|
||||
LOG_DEBUG("is charging %d", axp.isChargeing());
|
||||
|
||||
return 30 * 1000;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// Heltec tracker specific init
|
||||
void lateInitVariant()
|
||||
{
|
||||
// LOG_DEBUG("Heltec tracker initVariant\n");
|
||||
// LOG_DEBUG("Heltec tracker initVariant");
|
||||
|
||||
#ifndef MESHTASTIC_EXCLUDE_GPS
|
||||
GpioVirtPin *virtGpsEnable = gps ? gps->enablePin : new GpioVirtPin();
|
||||
|
||||
@@ -39,7 +39,7 @@ class BluetoothPhoneAPI : public PhoneAPI
|
||||
{
|
||||
PhoneAPI::onNowHasData(fromRadioNum);
|
||||
|
||||
LOG_INFO("BLE notify fromNum\n");
|
||||
LOG_INFO("BLE notify fromNum");
|
||||
fromNum.notify32(fromRadioNum);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void onConnect(uint16_t conn_handle)
|
||||
connectionHandle = conn_handle;
|
||||
char central_name[32] = {0};
|
||||
connection->getPeerName(central_name, sizeof(central_name));
|
||||
LOG_INFO("BLE Connected to %s\n", central_name);
|
||||
LOG_INFO("BLE Connected to %s", central_name);
|
||||
}
|
||||
/**
|
||||
* Callback invoked when a connection is dropped
|
||||
@@ -69,7 +69,7 @@ void onConnect(uint16_t conn_handle)
|
||||
*/
|
||||
void onDisconnect(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
LOG_INFO("BLE Disconnected, reason = 0x%x\n", reason);
|
||||
LOG_INFO("BLE Disconnected, reason = 0x%x", reason);
|
||||
if (bluetoothPhoneAPI) {
|
||||
bluetoothPhoneAPI->close();
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void onDisconnect(uint16_t conn_handle, uint8_t reason)
|
||||
void onCccd(uint16_t conn_hdl, BLECharacteristic *chr, uint16_t cccd_value)
|
||||
{
|
||||
// Display the raw request packet
|
||||
LOG_INFO("CCCD Updated: %u\n", cccd_value);
|
||||
LOG_INFO("CCCD Updated: %u", cccd_value);
|
||||
// Check the characteristic this CCCD update is associated with in case
|
||||
// this handler is used for multiple CCCD records.
|
||||
|
||||
@@ -87,9 +87,9 @@ void onCccd(uint16_t conn_hdl, BLECharacteristic *chr, uint16_t cccd_value)
|
||||
if (chr->uuid == fromNum.uuid || chr->uuid == logRadio.uuid) {
|
||||
auto result = cccd_value == 2 ? chr->indicateEnabled(conn_hdl) : chr->notifyEnabled(conn_hdl);
|
||||
if (result) {
|
||||
LOG_INFO("Notify/Indicate enabled\n");
|
||||
LOG_INFO("Notify/Indicate enabled");
|
||||
} else {
|
||||
LOG_INFO("Notify/Indicate disabled\n");
|
||||
LOG_INFO("Notify/Indicate disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ void onFromRadioAuthorize(uint16_t conn_hdl, BLECharacteristic *chr, ble_gatts_e
|
||||
// or make empty if the queue is empty
|
||||
fromRadio.write(fromRadioBytes, numBytes);
|
||||
} else {
|
||||
// LOG_INFO("Ignoring successor read\n");
|
||||
// LOG_INFO("Ignoring successor read");
|
||||
}
|
||||
authorizeRead(conn_hdl);
|
||||
}
|
||||
@@ -146,13 +146,13 @@ static uint8_t lastToRadio[MAX_TO_FROM_RADIO_SIZE];
|
||||
|
||||
void onToRadioWrite(uint16_t conn_hdl, BLECharacteristic *chr, uint8_t *data, uint16_t len)
|
||||
{
|
||||
LOG_INFO("toRadioWriteCb data %p, len %u\n", data, len);
|
||||
LOG_INFO("toRadioWriteCb data %p, len %u", data, len);
|
||||
if (memcmp(lastToRadio, data, len) != 0) {
|
||||
LOG_DEBUG("New ToRadio packet\n");
|
||||
LOG_DEBUG("New ToRadio packet");
|
||||
memcpy(lastToRadio, data, len);
|
||||
bluetoothPhoneAPI->handleToRadio(data, len);
|
||||
} else {
|
||||
LOG_DEBUG("Dropping duplicate ToRadio packet we just saw\n");
|
||||
LOG_DEBUG("Dropping duplicate ToRadio packet we just saw");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,11 +207,11 @@ static uint32_t configuredPasskey;
|
||||
void NRF52Bluetooth::shutdown()
|
||||
{
|
||||
// Shutdown bluetooth for minimum power draw
|
||||
LOG_INFO("Disable NRF52 bluetooth\n");
|
||||
LOG_INFO("Disable NRF52 bluetooth");
|
||||
uint8_t connection_num = Bluefruit.connected();
|
||||
if (connection_num) {
|
||||
for (uint8_t i = 0; i < connection_num; i++) {
|
||||
LOG_INFO("NRF52 bluetooth disconnecting handle %d\n", i);
|
||||
LOG_INFO("NRF52 bluetooth disconnecting handle %d", i);
|
||||
Bluefruit.disconnect(i);
|
||||
}
|
||||
delay(100); // wait for ondisconnect;
|
||||
@@ -225,7 +225,7 @@ void NRF52Bluetooth::startDisabled()
|
||||
// Shutdown bluetooth for minimum power draw
|
||||
Bluefruit.Advertising.stop();
|
||||
Bluefruit.setTxPower(-40); // Minimum power
|
||||
LOG_INFO("Disabling NRF52 Bluetooth. (Workaround: tx power min, advertising stopped)\n");
|
||||
LOG_INFO("Disabling NRF52 Bluetooth. (Workaround: tx power min, advertising stopped)");
|
||||
}
|
||||
bool NRF52Bluetooth::isConnected()
|
||||
{
|
||||
@@ -238,7 +238,7 @@ int NRF52Bluetooth::getRssi()
|
||||
void NRF52Bluetooth::setup()
|
||||
{
|
||||
// Initialise the Bluefruit module
|
||||
LOG_INFO("Initialize the Bluefruit nRF52 module\n");
|
||||
LOG_INFO("Initialize the Bluefruit nRF52 module");
|
||||
Bluefruit.autoConnLed(false);
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
Bluefruit.begin();
|
||||
@@ -251,7 +251,7 @@ void NRF52Bluetooth::setup()
|
||||
? config.bluetooth.fixed_pin
|
||||
: random(100000, 999999);
|
||||
auto pinString = std::to_string(configuredPasskey);
|
||||
LOG_INFO("Bluetooth pin set to '%i'\n", configuredPasskey);
|
||||
LOG_INFO("Bluetooth pin set to '%i'", configuredPasskey);
|
||||
Bluefruit.Security.setPIN(pinString.c_str());
|
||||
Bluefruit.Security.setIOCaps(true, false, false);
|
||||
Bluefruit.Security.setPairPasskeyCallback(NRF52Bluetooth::onPairingPasskey);
|
||||
@@ -275,22 +275,22 @@ void NRF52Bluetooth::setup()
|
||||
bledfusecure.begin(); // Install the DFU helper
|
||||
#endif
|
||||
// Configure and Start the Device Information Service
|
||||
LOG_INFO("Configuring the Device Information Service\n");
|
||||
LOG_INFO("Configuring the Device Information Service");
|
||||
bledis.setModel(optstr(HW_VERSION));
|
||||
bledis.setFirmwareRev(optstr(APP_VERSION));
|
||||
bledis.begin();
|
||||
// Start the BLE Battery Service and set it to 100%
|
||||
LOG_INFO("Configuring the Battery Service\n");
|
||||
LOG_INFO("Configuring the Battery Service");
|
||||
blebas.begin();
|
||||
blebas.write(0); // Unknown battery level for now
|
||||
// Setup the Heart Rate Monitor service using
|
||||
// BLEService and BLECharacteristic classes
|
||||
LOG_INFO("Configuring the Mesh bluetooth service\n");
|
||||
LOG_INFO("Configuring the Mesh bluetooth service");
|
||||
setupMeshService();
|
||||
// Setup the advertising packet(s)
|
||||
LOG_INFO("Setting up the advertising payload(s)\n");
|
||||
LOG_INFO("Setting up the advertising payload(s)");
|
||||
startAdv();
|
||||
LOG_INFO("Advertising\n");
|
||||
LOG_INFO("Advertising");
|
||||
}
|
||||
void NRF52Bluetooth::resumeAdvertising()
|
||||
{
|
||||
@@ -306,7 +306,7 @@ void updateBatteryLevel(uint8_t level)
|
||||
}
|
||||
void NRF52Bluetooth::clearBonds()
|
||||
{
|
||||
LOG_INFO("Clearing bluetooth bonds!\n");
|
||||
LOG_INFO("Clearing bluetooth bonds!");
|
||||
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
||||
bond_print_list(BLE_GAP_ROLE_CENTRAL);
|
||||
Bluefruit.Periph.clearBonds();
|
||||
@@ -314,11 +314,11 @@ void NRF52Bluetooth::clearBonds()
|
||||
}
|
||||
void NRF52Bluetooth::onConnectionSecured(uint16_t conn_handle)
|
||||
{
|
||||
LOG_INFO("BLE connection secured\n");
|
||||
LOG_INFO("BLE connection secured");
|
||||
}
|
||||
bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passkey[6], bool match_request)
|
||||
{
|
||||
LOG_INFO("BLE pairing process started with passkey %.3s %.3s\n", passkey, passkey + 3);
|
||||
LOG_INFO("BLE pairing process started with passkey %.3s %.3s", passkey, passkey + 3);
|
||||
powerFSM.trigger(EVENT_BLUETOOTH_PAIR);
|
||||
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
|
||||
screen->startAlert([](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void {
|
||||
@@ -354,15 +354,15 @@ bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passke
|
||||
break;
|
||||
}
|
||||
}
|
||||
LOG_INFO("BLE passkey pairing: match_request=%i\n", match_request);
|
||||
LOG_INFO("BLE passkey pairing: match_request=%i", match_request);
|
||||
return true;
|
||||
}
|
||||
void NRF52Bluetooth::onPairingCompleted(uint16_t conn_handle, uint8_t auth_status)
|
||||
{
|
||||
if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS)
|
||||
LOG_INFO("BLE pairing success\n");
|
||||
LOG_INFO("BLE pairing success");
|
||||
else
|
||||
LOG_INFO("BLE pairing failed\n");
|
||||
LOG_INFO("BLE pairing failed");
|
||||
screen->endAlert();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ bool loopCanSleep()
|
||||
// handle standard gcc assert failures
|
||||
void __attribute__((noreturn)) __assert_func(const char *file, int line, const char *func, const char *failedexpr)
|
||||
{
|
||||
LOG_ERROR("assert failed %s: %d, %s, test=%s\n", file, line, func, failedexpr);
|
||||
LOG_ERROR("assert failed %s: %d, %s, test=%s", file, line, func, failedexpr);
|
||||
// debugger_break(); FIXME doesn't work, possibly not for segger
|
||||
// Reboot cpu
|
||||
NVIC_SystemReset();
|
||||
@@ -74,7 +74,7 @@ void setBluetoothEnable(bool enable)
|
||||
// For debugging use: don't use bluetooth
|
||||
if (!useSoftDevice) {
|
||||
if (enable)
|
||||
LOG_INFO("DISABLING NRF52 BLUETOOTH WHILE DEBUGGING\n");
|
||||
LOG_INFO("DISABLING NRF52 BLUETOOTH WHILE DEBUGGING");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ void setBluetoothEnable(bool enable)
|
||||
|
||||
// If not yet set-up
|
||||
if (!nrf52Bluetooth) {
|
||||
LOG_DEBUG("Initializing NRF52 Bluetooth\n");
|
||||
LOG_DEBUG("Initializing NRF52 Bluetooth");
|
||||
nrf52Bluetooth = new NRF52Bluetooth();
|
||||
nrf52Bluetooth->setup();
|
||||
|
||||
@@ -141,7 +141,7 @@ void checkSDEvents()
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_DEBUG("Unexpected SDevt %d\n", evt);
|
||||
LOG_DEBUG("Unexpected SDevt %d", evt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ void nrf52Setup()
|
||||
uint32_t why = NRF_POWER->RESETREAS;
|
||||
// per
|
||||
// https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpower.html
|
||||
LOG_DEBUG("Reset reason: 0x%x\n", why);
|
||||
LOG_DEBUG("Reset reason: 0x%x", why);
|
||||
|
||||
#ifdef USE_SEMIHOSTING
|
||||
nrf52InitSemiHosting();
|
||||
@@ -202,7 +202,7 @@ void nrf52Setup()
|
||||
#ifdef BQ25703A_ADDR
|
||||
auto *bq = new BQ25713();
|
||||
if (!bq->setup())
|
||||
LOG_ERROR("ERROR! Charge controller init failed\n");
|
||||
LOG_ERROR("ERROR! Charge controller init failed");
|
||||
#endif
|
||||
|
||||
// Init random seed
|
||||
@@ -212,7 +212,7 @@ void nrf52Setup()
|
||||
} seed;
|
||||
nRFCrypto.begin();
|
||||
nRFCrypto.Random.generate(seed.seed8, sizeof(seed.seed8));
|
||||
LOG_DEBUG("Setting random seed %u\n", seed.seed32);
|
||||
LOG_DEBUG("Setting random seed %u", seed.seed32);
|
||||
randomSeed(seed.seed32);
|
||||
nRFCrypto.end();
|
||||
}
|
||||
@@ -280,7 +280,7 @@ void cpuDeepSleep(uint32_t msecToWake)
|
||||
// https://devzone.nordicsemi.com/f/nordic-q-a/48919/ram-retention-settings-with-softdevice-enabled
|
||||
auto ok = sd_power_system_off();
|
||||
if (ok != NRF_SUCCESS) {
|
||||
LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!\n");
|
||||
LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!");
|
||||
NRF_POWER->SYSTEMOFF = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ ErrorCode SimRadio::send(meshtastic_MeshPacket *p)
|
||||
|
||||
// set (random) transmit delay to let others reconfigure their radio,
|
||||
// to avoid collisions and implement timing-based flooding
|
||||
LOG_DEBUG("Set random delay before transmitting.\n");
|
||||
LOG_DEBUG("Set random delay before transmitting.");
|
||||
setTransmitDelay();
|
||||
return res;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ void SimRadio::setTransmitDelay()
|
||||
startTransmitTimer(true);
|
||||
} else {
|
||||
// If there is a SNR, start a timer scaled based on that SNR.
|
||||
LOG_DEBUG("rx_snr found. hop_limit:%d rx_snr:%f\n", p->hop_limit, p->rx_snr);
|
||||
LOG_DEBUG("rx_snr found. hop_limit:%d rx_snr:%f", p->hop_limit, p->rx_snr);
|
||||
startTransmitTimerSNR(p->rx_snr);
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ void SimRadio::startTransmitTimer(bool withDelay)
|
||||
// If we have work to do and the timer wasn't already scheduled, schedule it now
|
||||
if (!txQueue.empty()) {
|
||||
uint32_t delayMsec = !withDelay ? 1 : getTxDelayMsec();
|
||||
// LOG_DEBUG("xmit timer %d\n", delay);
|
||||
// LOG_DEBUG("xmit timer %d", delay);
|
||||
notifyLater(delayMsec, TRANSMIT_DELAY_COMPLETED, false);
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ void SimRadio::startTransmitTimerSNR(float snr)
|
||||
// If we have work to do and the timer wasn't already scheduled, schedule it now
|
||||
if (!txQueue.empty()) {
|
||||
uint32_t delayMsec = getTxDelayMsecWeighted(snr);
|
||||
// LOG_DEBUG("xmit timer %d\n", delay);
|
||||
// LOG_DEBUG("xmit timer %d", delay);
|
||||
notifyLater(delayMsec, TRANSMIT_DELAY_COMPLETED, false);
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ void SimRadio::completeSending()
|
||||
|
||||
// We are done sending that packet, release it
|
||||
packetPool.release(p);
|
||||
// LOG_DEBUG("Done with send\n");
|
||||
// LOG_DEBUG("Done with send");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ bool SimRadio::canSendImmediately()
|
||||
|
||||
if (busyTx || busyRx) {
|
||||
if (busyTx)
|
||||
LOG_WARN("Can not send yet, busyTx\n");
|
||||
LOG_WARN("Can not send yet, busyTx");
|
||||
if (busyRx)
|
||||
LOG_WARN("Can not send yet, busyRx\n");
|
||||
LOG_WARN("Can not send yet, busyRx");
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
@@ -129,7 +129,7 @@ bool SimRadio::cancelSending(NodeNum from, PacketId id)
|
||||
packetPool.release(p); // free the packet we just removed
|
||||
|
||||
bool result = (p != NULL);
|
||||
LOG_DEBUG("cancelSending id=0x%x, removed=%d\n", id, result);
|
||||
LOG_DEBUG("cancelSending id=0x%x, removed=%d", id, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -138,25 +138,25 @@ void SimRadio::onNotify(uint32_t notification)
|
||||
switch (notification) {
|
||||
case ISR_TX:
|
||||
handleTransmitInterrupt();
|
||||
// LOG_DEBUG("tx complete - starting timer\n");
|
||||
// LOG_DEBUG("tx complete - starting timer");
|
||||
startTransmitTimer();
|
||||
break;
|
||||
case ISR_RX:
|
||||
// LOG_DEBUG("rx complete - starting timer\n");
|
||||
// LOG_DEBUG("rx complete - starting timer");
|
||||
startTransmitTimer();
|
||||
break;
|
||||
case TRANSMIT_DELAY_COMPLETED:
|
||||
LOG_DEBUG("delay done\n");
|
||||
LOG_DEBUG("delay done");
|
||||
|
||||
// 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?
|
||||
if (!txQueue.empty()) {
|
||||
if (!canSendImmediately()) {
|
||||
// LOG_DEBUG("Currently Rx/Tx-ing: set random delay\n");
|
||||
// LOG_DEBUG("Currently Rx/Tx-ing: set random delay");
|
||||
setTransmitDelay(); // currently Rx/Tx-ing: reset random delay
|
||||
} else {
|
||||
if (isChannelActive()) { // check if there is currently a LoRa packet on the channel
|
||||
// LOG_DEBUG("Channel is active: set random delay\n");
|
||||
// LOG_DEBUG("Channel is active: set random delay");
|
||||
setTransmitDelay(); // reset random delay
|
||||
} else {
|
||||
// Send any outgoing packets we have ready
|
||||
@@ -171,7 +171,7 @@ void SimRadio::onNotify(uint32_t notification)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// LOG_DEBUG("done with txqueue\n");
|
||||
// LOG_DEBUG("done with txqueue");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -188,12 +188,12 @@ void SimRadio::startSend(meshtastic_MeshPacket *txp)
|
||||
perhapsDecode(p);
|
||||
meshtastic_Compressed c = meshtastic_Compressed_init_default;
|
||||
c.portnum = p->decoded.portnum;
|
||||
// LOG_DEBUG("Sending back to simulator with portNum %d\n", p->decoded.portnum);
|
||||
// LOG_DEBUG("Sending back to simulator with portNum %d", p->decoded.portnum);
|
||||
if (p->decoded.payload.size <= sizeof(c.data.bytes)) {
|
||||
memcpy(&c.data.bytes, p->decoded.payload.bytes, p->decoded.payload.size);
|
||||
c.data.size = p->decoded.payload.size;
|
||||
} else {
|
||||
LOG_WARN("Payload size is larger than compressed message allows! Sending empty payload.\n");
|
||||
LOG_WARN("Payload size is larger than compressed message allows! Sending empty payload.");
|
||||
}
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Compressed_msg, &c);
|
||||
@@ -225,11 +225,11 @@ meshtastic_QueueStatus SimRadio::getQueueStatus()
|
||||
|
||||
void SimRadio::handleReceiveInterrupt(meshtastic_MeshPacket *p)
|
||||
{
|
||||
LOG_DEBUG("HANDLE RECEIVE INTERRUPT\n");
|
||||
LOG_DEBUG("HANDLE RECEIVE INTERRUPT");
|
||||
uint32_t xmitMsec;
|
||||
|
||||
if (!isReceiving) {
|
||||
LOG_DEBUG("*** WAS_ASSERT *** handleReceiveInterrupt called when not in receive mode\n");
|
||||
LOG_DEBUG("*** WAS_ASSERT *** handleReceiveInterrupt called when not in receive mode");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ void SimRadio::handleReceiveInterrupt(meshtastic_MeshPacket *p)
|
||||
// read the number of actually received bytes
|
||||
size_t length = getPacketLength(p);
|
||||
xmitMsec = getPacketTime(length);
|
||||
// LOG_DEBUG("Payload size %d vs length (includes header) %d\n", p->decoded.payload.size, length);
|
||||
// LOG_DEBUG("Payload size %d vs length (includes header) %d", p->decoded.payload.size, length);
|
||||
|
||||
meshtastic_MeshPacket *mp = packetPool.allocCopy(*p); // keep a copy in packetPool
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ void epoch_to_datetime(time_t epoch, datetime_t *dt)
|
||||
|
||||
void debug_date(datetime_t t)
|
||||
{
|
||||
LOG_DEBUG("%d %d %d %d %d %d %d\n", t.year, t.month, t.day, t.hour, t.min, t.sec, t.dotw);
|
||||
LOG_DEBUG("%d %d %d %d %d %d %d", t.year, t.month, t.day, t.hour, t.min, t.sec, t.dotw);
|
||||
uart_default_tx_wait_blocking();
|
||||
}
|
||||
|
||||
@@ -103,15 +103,15 @@ void rp2040Setup()
|
||||
uint f_clk_adc = frequency_count_khz(CLOCKS_FC0_SRC_VALUE_CLK_ADC);
|
||||
uint f_clk_rtc = frequency_count_khz(CLOCKS_FC0_SRC_VALUE_CLK_RTC);
|
||||
|
||||
LOG_INFO("Clock speed:\n");
|
||||
LOG_INFO("pll_sys = %dkHz\n", f_pll_sys);
|
||||
LOG_INFO("pll_usb = %dkHz\n", f_pll_usb);
|
||||
LOG_INFO("rosc = %dkHz\n", f_rosc);
|
||||
LOG_INFO("clk_sys = %dkHz\n", f_clk_sys);
|
||||
LOG_INFO("clk_peri = %dkHz\n", f_clk_peri);
|
||||
LOG_INFO("clk_usb = %dkHz\n", f_clk_usb);
|
||||
LOG_INFO("clk_adc = %dkHz\n", f_clk_adc);
|
||||
LOG_INFO("clk_rtc = %dkHz\n", f_clk_rtc);
|
||||
LOG_INFO("Clock speed:");
|
||||
LOG_INFO("pll_sys = %dkHz", f_pll_sys);
|
||||
LOG_INFO("pll_usb = %dkHz", f_pll_usb);
|
||||
LOG_INFO("rosc = %dkHz", f_rosc);
|
||||
LOG_INFO("clk_sys = %dkHz", f_clk_sys);
|
||||
LOG_INFO("clk_peri = %dkHz", f_clk_peri);
|
||||
LOG_INFO("clk_usb = %dkHz", f_clk_usb);
|
||||
LOG_INFO("clk_adc = %dkHz", f_clk_adc);
|
||||
LOG_INFO("clk_rtc = %dkHz", f_clk_rtc);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user