Combined flash + key exchange flow with version check and USB permission persistence

- Firmware: add VERSION? command returning BUILD_NR for version check
- Android: flash button checks firmware version first, skips flash if current
- After flash: auto key exchange via reboot detection (expectingReboot flag)
- device_filter.xml + intent-filter: USB permission 'always allow' checkbox
- singleTop + onNewIntent prevents unwanted SettingsActivity launch on USB connect
- platformio.ini: upload_port updated to /dev/ttyACM1
This commit is contained in:
eddy 2026-07-29 22:56:40 +02:00
commit d6d6f6674a
7 changed files with 87 additions and 14 deletions

View file

@ -22,6 +22,7 @@
#define NVS_NAMESPACE "hmac"
#define NVS_KEY_NAME "key"
#define NVS_UUID_NAME "uuid"
#define FIRMWARE_VERSION "1"
NimBLECharacteristic *pCharacteristic;
bool deviceConnected = false;
@ -250,6 +251,9 @@ void loop() {
} else {
Serial.println("NO_KEY");
}
} else if (serialBuf == "VERSION?") {
Serial.print("BUILD_NR:");
Serial.println(FIRMWARE_VERSION);
} else if (serialBuf.startsWith("SET_KEY:")) {
String hex = serialBuf.substring(8);
hex.toUpperCase();