Compare commits

...

2 Commits

Author SHA1 Message Date
jacob.eva
860fe3c005
Add option to wipe BLE bonds 2024-10-23 11:16:13 +01:00
jacob.eva
a60ad3445e
Adjust TX power PA curve 2024-10-23 11:12:46 +01:00
4 changed files with 35 additions and 26 deletions

View File

@ -371,6 +371,12 @@ char bt_devname[11];
#elif MCU_VARIANT == MCU_NRF52 #elif MCU_VARIANT == MCU_NRF52
uint8_t eeprom_read(uint32_t mapped_addr); uint8_t eeprom_read(uint32_t mapped_addr);
void bt_bond_wipe() {
// Delete all bonding data
Bluefruit.Periph.clearBonds();
led_indicate_info(2);
}
void bt_stop() { void bt_stop() {
if (bt_state != BT_STATE_OFF) { if (bt_state != BT_STATE_OFF) {
bt_allow_pairing = false; bt_allow_pairing = false;

View File

@ -22,6 +22,7 @@
#define BUTTON_MIN_DURATION 50 #define BUTTON_MIN_DURATION 50
#define BUTTON_3S_DURATION 3000 #define BUTTON_3S_DURATION 3000
#define BUTTON_6S_DURATION 6000 #define BUTTON_6S_DURATION 6000
#define BUTTON_9S_DURATION 9000
#define EVENT_ALL 0x00 #define EVENT_ALL 0x00
#define EVENT_CLICKS 0x01 #define EVENT_CLICKS 0x01

View File

@ -2256,74 +2256,74 @@ void sx128x::setTxPower(int level, int outputPin) {
reg_value = -18; reg_value = -18;
break; break;
case 1: case 1:
reg_value = -17;
break;
case 2:
reg_value = -16; reg_value = -16;
break; break;
case 3: case 2:
reg_value = -15; reg_value = -15;
break; break;
case 4: case 3:
reg_value = -14; reg_value = -14;
break; break;
case 5: case 4:
reg_value = -13; reg_value = -13;
break; break;
case 6: case 5:
reg_value = -12; reg_value = -12;
break; break;
case 7: case 6:
reg_value = -10; reg_value = -11;
break; break;
case 8: case 7:
reg_value = -9; reg_value = -9;
break; break;
case 9: case 8:
reg_value = -8; reg_value = -8;
break; break;
case 10: case 9:
reg_value = -7; reg_value = -7;
break; break;
case 11: case 10:
reg_value = -6; reg_value = -6;
break; break;
case 12: case 11:
reg_value = -5; reg_value = -5;
break; break;
case 13: case 12:
reg_value = -4; reg_value = -4;
break; break;
case 14: case 13:
reg_value = -3; reg_value = -3;
break; break;
case 15: case 14:
reg_value = -2; reg_value = -2;
break; break;
case 16: case 15:
reg_value = -1; reg_value = -1;
break; break;
case 17: case 16:
reg_value = 0; reg_value = 0;
break; break;
case 18: case 17:
reg_value = 1; reg_value = 1;
break; break;
case 19: case 18:
reg_value = 2; reg_value = 2;
break; break;
case 20: case 19:
reg_value = 3; reg_value = 3;
break; break;
case 21: case 20:
reg_value = 4; reg_value = 4;
break; break;
case 22: case 21:
reg_value = 5; reg_value = 5;
break; break;
case 23: case 22:
reg_value = 6; reg_value = 6;
break; break;
case 23:
reg_value = 7;
break;
case 24: case 24:
reg_value = 8; reg_value = 8;
break; break;

View File

@ -1489,7 +1489,9 @@ void process_serial() {
#if HAS_INPUT #if HAS_INPUT
void button_event(uint8_t event, unsigned long duration) { void button_event(uint8_t event, unsigned long duration) {
if (duration > BUTTON_MIN_DURATION) { if (duration > BUTTON_MIN_DURATION) {
if (duration > BUTTON_6S_DURATION) { if (duration > BUTTON_9S_DURATION) {
bt_bond_wipe();
} else if (duration > BUTTON_6S_DURATION) {
bt_stop(); bt_stop();
bt_conf_save(false); bt_conf_save(false);
} else if (duration > BUTTON_3S_DURATION) { } else if (duration > BUTTON_3S_DURATION) {