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:
Thomas Göttgens
2024-10-14 06:11:43 +02:00
committed by GitHub
parent fb9f361052
commit 05e4a639a1
150 changed files with 1816 additions and 1800 deletions

View File

@@ -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();
}