mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-27 00:59:10 +03:00
snapshot gpios in temporarly ram
This commit is contained in:
@@ -107,8 +107,6 @@ bool System::led_flash_timer_ = false;
|
||||
// GPIOs
|
||||
std::vector<uint8_t, AllocatorPSRAM<uint8_t>> System::valid_system_gpios_;
|
||||
std::vector<uint8_t, AllocatorPSRAM<uint8_t>> System::used_gpios_;
|
||||
std::vector<uint8_t, AllocatorPSRAM<uint8_t>> System::snapshot_used_gpios_;
|
||||
std::vector<uint8_t, AllocatorPSRAM<uint8_t>> System::snapshot_valid_system_gpios_;
|
||||
|
||||
// find the index of the language
|
||||
// 0 = EN, 1 = DE, etc...
|
||||
@@ -2923,37 +2921,26 @@ std::vector<uint8_t> System::available_gpios() {
|
||||
}
|
||||
|
||||
// make a snapshot of the current GPIOs
|
||||
void System::make_snapshot_gpios() {
|
||||
snapshot_used_gpios_.clear();
|
||||
void System::make_snapshot_gpios(std::vector<int8_t> & u_gpios, std::vector<int8_t> & s_gpios) {
|
||||
for (const auto & gpio : used_gpios_) {
|
||||
snapshot_used_gpios_.push_back(gpio);
|
||||
u_gpios.push_back(gpio);
|
||||
}
|
||||
|
||||
snapshot_valid_system_gpios_.clear();
|
||||
for (const auto & gpio : valid_system_gpios_) {
|
||||
snapshot_valid_system_gpios_.push_back(gpio);
|
||||
s_gpios.push_back(gpio);
|
||||
}
|
||||
}
|
||||
|
||||
// restore the GPIOs from the snapshot
|
||||
void System::restore_snapshot_gpios() {
|
||||
void System::restore_snapshot_gpios(std::vector<int8_t> & u_gpios, std::vector<int8_t> & s_gpios) {
|
||||
used_gpios_.clear();
|
||||
for (const auto & gpio : snapshot_used_gpios_) {
|
||||
for (const auto & gpio : u_gpios) {
|
||||
used_gpios_.push_back(gpio);
|
||||
}
|
||||
|
||||
valid_system_gpios_.clear();
|
||||
for (const auto & gpio : snapshot_valid_system_gpios_) {
|
||||
for (const auto & gpio : s_gpios) {
|
||||
valid_system_gpios_.push_back(gpio);
|
||||
}
|
||||
|
||||
// clear the snapshot
|
||||
clear_snapshot_gpios();
|
||||
}
|
||||
|
||||
void System::clear_snapshot_gpios() {
|
||||
snapshot_used_gpios_.clear();
|
||||
snapshot_valid_system_gpios_.clear();
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
@@ -163,9 +163,8 @@ class System {
|
||||
static bool add_gpio(uint8_t pin, const char * source_name);
|
||||
static std::vector<uint8_t> available_gpios();
|
||||
static bool load_board_profile(std::vector<int8_t> & data, const std::string & board_profile);
|
||||
static void make_snapshot_gpios();
|
||||
static void restore_snapshot_gpios();
|
||||
static void clear_snapshot_gpios();
|
||||
static void make_snapshot_gpios(std::vector<int8_t> & u_gpios, std::vector<int8_t> & s_gpios);
|
||||
static void restore_snapshot_gpios(std::vector<int8_t> & u_gpios, std::vector<int8_t> & s_gpios);
|
||||
|
||||
static bool readCommand(const char * data);
|
||||
|
||||
@@ -438,10 +437,8 @@ class System {
|
||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> string_range_to_vector(const std::string & range);
|
||||
|
||||
// GPIOs
|
||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> valid_system_gpios_; // list of valid GPIOs for the ESP32 board that can be used
|
||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> used_gpios_; // list of GPIOs used by the application
|
||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> snapshot_used_gpios_; // snapshot of the used GPIOs
|
||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> snapshot_valid_system_gpios_; // snapshot of the valid GPIOs
|
||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> valid_system_gpios_; // list of valid GPIOs for the ESP32 board that can be used
|
||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> used_gpios_; // list of GPIOs used by the application
|
||||
|
||||
int8_t wifi_quality(int8_t dBm);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user