Merge branch 'master' into pcf8563rtc

This commit is contained in:
Thomas Göttgens 2022-09-29 16:33:43 +02:00 committed by GitHub
commit 05126bc6dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 6 deletions

View File

@ -131,7 +131,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
#endif
// DEBUG_MSG("battery gpio %d raw val=%u scaled=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled));
last_read_value = scaled;
return scaled * 1000;
return scaled;
} else {
return last_read_value;
}

View File

@ -225,13 +225,20 @@ void NodeDB::installDefaultChannels()
channelFile.version = DEVICESTATE_CUR_VER;
}
void NodeDB::resetNodes()
{
devicestate.node_db_count = 0;
memset(devicestate.node_db, 0, sizeof(devicestate.node_db));
saveDeviceStateToDisk();
}
void NodeDB::installDefaultDeviceState()
{
DEBUG_MSG("Installing default DeviceState\n");
memset(&devicestate, 0, sizeof(DeviceState));
*numNodes = 0; // Forget node DB
*numNodes = 0;
// init our devicestate with valid flags so protobuf writing/reading will work
devicestate.has_my_node = true;
devicestate.has_owner = true;

View File

@ -115,7 +115,7 @@ class NodeDB
/// Return the number of nodes we've heard from recently (within the last 2 hrs?)
size_t getNumOnlineNodes();
void initConfigIntervals(), initModuleConfigIntervals();
void initConfigIntervals(), initModuleConfigIntervals(), resetNodes();
bool factoryReset();

View File

@ -120,6 +120,12 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
rebootAtMsec = millis() + (5 * 1000);
break;
}
case AdminMessage_nodedb_reset_tag: {
DEBUG_MSG("Initiating node-db reset\n");
nodeDB.resetNodes();
rebootAtMsec = millis() + (5 * 1000);
break;
}
#ifdef ARCH_PORTDUINO
case AdminMessage_exit_simulator_tag:
DEBUG_MSG("Exiting simulator\n");

View File

@ -1,5 +1,5 @@
[env:tlora-v2-1-1.6]
extends = esp32_base
board = ttgo-lora32-v1
board = ttgo-lora32-v21
build_flags =
${esp32_base.build_flags} -D TLORA_V2_1_16 -I variants/tlora_v2_1_16

View File

@ -12,7 +12,7 @@
#define I2C_SDA 21 // I2C pins for this board
#define I2C_SCL 22
#define RESET_OLED 16 // If defined, this pin will be used to reset the display controller
// #define RESET_OLED 16 // If defined, this pin will be used to reset the display controller. Crashes on newer ESP-IDF and not needed per schematic
#define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost
#define LED_PIN 25 // If defined we will blink this LED