Merge branch 'master' of github.com:meshtastic/Meshtastic-device

This commit is contained in:
Thomas Göttgens 2022-10-24 23:11:56 +02:00
commit 9fac57b713
3 changed files with 6 additions and 38 deletions

View File

@ -159,21 +159,16 @@ class ButtonThread : public concurrency::OSThread
static void userButtonDoublePressed() static void userButtonDoublePressed()
{ {
#ifdef ARCH_ESP32 #if defined(USE_EINK)
disablePin();
#elif defined(USE_EINK)
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW); digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
#endif #endif
} }
static void userButtonMultiPressed() static void userButtonMultiPressed()
{ {
#ifdef ARCH_ESP32 screen->print("Sent ad-hoc ping\n");
clearNVS(); service.refreshMyNodeInfo();
#endif service.sendNetworkPing(NODENUM_BROADCAST, true);
#ifdef ARCH_NRF52
clearBonds();
#endif
} }
static void userButtonPressedLongStart() static void userButtonPressedLongStart()

View File

@ -12,7 +12,6 @@ NimBLECharacteristic *fromNumCharacteristic;
NimBLEServer *bleServer; NimBLEServer *bleServer;
static bool passkeyShowing; static bool passkeyShowing;
static uint32_t doublepressed;
class BluetoothPhoneAPI : public PhoneAPI class BluetoothPhoneAPI : public PhoneAPI
{ {
@ -71,12 +70,8 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
{ {
virtual uint32_t onPassKeyRequest() { virtual uint32_t onPassKeyRequest() {
uint32_t passkey = config.bluetooth.fixed_pin; uint32_t passkey = config.bluetooth.fixed_pin;
if (doublepressed > 0 && (doublepressed + (30 * 1000)) > millis()) { if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_RANDOM_PIN) {
DEBUG_MSG("User has set BLE pairing mode to fixed-pin\n");
config.bluetooth.mode = Config_BluetoothConfig_PairingMode_FIXED_PIN;
nodeDB.saveToDisk(SEGMENT_CONFIG);
} else if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_RANDOM_PIN) {
DEBUG_MSG("Using random passkey\n"); DEBUG_MSG("Using random passkey\n");
// This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits // This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits
passkey = random(100000, 999999); passkey = random(100000, 999999);
@ -202,24 +197,3 @@ void clearNVS()
ESP.restart(); ESP.restart();
#endif #endif
} }
void disablePin()
{
DEBUG_MSG("User Override, disabling bluetooth pin requirement\n");
// keep track of when it was pressed, so we know it was within X seconds
// Flash the LED
setLed(true);
delay(100);
setLed(false);
delay(100);
setLed(true);
delay(100);
setLed(false);
delay(100);
setLed(true);
delay(100);
setLed(false);
doublepressed = millis();
}

View File

@ -15,4 +15,3 @@ class NimbleBluetooth
void setBluetoothEnable(bool on); void setBluetoothEnable(bool on);
void clearNVS(); void clearNVS();
void disablePin();