]> git.tnoah.ca Git - lora-radio.git/commitdiff
Cleanup
authorMark Qvist <mark@unsigned.io>
Mon, 13 Jan 2025 19:06:51 +0000 (20:06 +0100)
committerMark Qvist <mark@unsigned.io>
Mon, 13 Jan 2025 19:06:51 +0000 (20:06 +0100)
Bluetooth.h
Power.h
Utilities.h

index 72f4ab0e2319436cbb573f95b0a4a55346a022a8..bbb0c829d3c4957fd8131df53c33cbff25e5ce73 100644 (file)
@@ -383,6 +383,8 @@ char bt_devname[11];
     }
   }
 
+  void bt_flush() { if (bt_state == BT_STATE_CONNECTED) { SerialBT.flushTXD(); } }
+
   void bt_disable_pairing() {
     bt_allow_pairing = false;
     bt_ssp_pin = 0;
diff --git a/Power.h b/Power.h
index b88a66f75e4d97d8ad46abbd3161e572d7ed2421..0379c4902f683e994120a9851e1267edc6852e41 100644 (file)
--- a/Power.h
+++ b/Power.h
@@ -216,11 +216,8 @@ void measure_battery() {
 
       // if (bt_state == BT_STATE_CONNECTED) {
       //   SerialBT.printf("Bus voltage %.3fv. Unfiltered %.3fv.", battery_voltage, bat_v_samples[BAT_SAMPLES-1]);
-      //   if (bat_voltage_dropping) {
-      //     SerialBT.printf(" Voltage is dropping. Percentage %.1f%%.", battery_percent);
-      //   } else {
-      //     SerialBT.printf(" Voltage is not dropping. Percentage %.1f%%.", battery_percent);
-      //   }
+      //   if (bat_voltage_dropping) { SerialBT.printf(" Voltage is dropping. Percentage %.1f%%.", battery_percent); }
+      //   else                      { SerialBT.printf(" Voltage is not dropping. Percentage %.1f%%.", battery_percent); }
       //   if (battery_state == BATTERY_STATE_DISCHARGING) { SerialBT.printf(" Battery discharging. delay_v %.3fv", bat_delay_v); }
       //   if (battery_state == BATTERY_STATE_CHARGING) { SerialBT.printf(" Battery charging. delay_v %.3fv", bat_delay_v); }
       //   if (battery_state == BATTERY_STATE_CHARGED) { SerialBT.print(" Battery is charged."); }
index 9a5d51e009ce31a68207e2bd9f5380b57d6ac677..06c6819f41d927ef3e0d118be1ed7f327b7138c4 100644 (file)
@@ -732,13 +732,8 @@ void serial_write(uint8_t byte) {
       #if MCU_VARIANT == MCU_NRF52 && HAS_BLE
              // This ensures that the TX buffer is flushed after a frame is queued in serial.
              // serial_in_frame is used to ensure that the flush only happens at the end of the frame
-             if (serial_in_frame && byte == FEND) {
-                 SerialBT.flushTXD();
-                 serial_in_frame = false;
-             }
-             else if (!serial_in_frame && byte == FEND) {
-                 serial_in_frame = true;
-             }
+             if (serial_in_frame && byte == FEND) { SerialBT.flushTXD(); serial_in_frame = false; }
+             else if (!serial_in_frame && byte == FEND) { serial_in_frame = true; }
       #endif
                }
        #else