Preserve the compact STM32WL interface and profile storage path
This commit is contained in:
1 parent
cebd0fdbeb
commit
9d973d353a
5 files changed
+32
-6
No files matched your search
@@ -99,6 +99,7 @@ public:
|
||||
virtual void begin() { }
|
||||
virtual RadioProfiles* profiles() { return nullptr; }
|
||||
virtual const RadioProfiles* profiles() const { return nullptr; }
|
||||
#if MESH_RADIO_SWITCH_TUNING
|
||||
virtual RadioSwitchCapabilities switchTuningCapabilities() const { return {}; }
|
||||
virtual RadioSwitchTuning switchTuning() const { return {}; }
|
||||
virtual uint32_t switchSpiHz() const { return 0; }
|
||||
@@ -109,6 +110,7 @@ public:
|
||||
bool (*)(void*, const RadioSwitchTuning&) = nullptr, void* = nullptr) {
|
||||
return RadioParamApplyResult::FAILED;
|
||||
}
|
||||
#endif
|
||||
virtual bool validateProfile(const RadioProfileParams&) const { return false; }
|
||||
virtual bool supportsMeshtext() const { return false; }
|
||||
virtual bool supportsEthernetTunnel() const { return false; }
|
||||
|
||||
@@ -203,9 +203,24 @@ bool RadioProfileCLI::prepareSavedImage(const char* path, const RadioProfileConf
|
||||
}
|
||||
|
||||
bool RadioProfileCLI::commitSavedImage(const char* path) {
|
||||
#if MESH_RADIO_SWITCH_TUNING
|
||||
return commitImage(path, ImagePath, BackupPath, hold_);
|
||||
#else
|
||||
if (!fs_ || hold_) return false;
|
||||
if (fs_->exists(ImagePath)) {
|
||||
if (fs_->exists(BackupPath) && !fs_->remove(BackupPath)) return false;
|
||||
if (!fs_->rename(ImagePath, BackupPath)) return false;
|
||||
}
|
||||
if (!fs_->rename(path, ImagePath)) {
|
||||
if (fs_->exists(BackupPath) && !fs_->rename(BackupPath, ImagePath)) hold_ = true;
|
||||
return false;
|
||||
}
|
||||
if (fs_->exists(BackupPath)) fs_->remove(BackupPath);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MESH_RADIO_SWITCH_TUNING
|
||||
bool RadioProfileCLI::commitImage(const char* path, const char* active,
|
||||
const char* backup, bool& hold, bool preserve_backup) {
|
||||
if (!fs_ || hold) return false;
|
||||
@@ -225,7 +240,6 @@ bool RadioProfileCLI::commitImage(const char* path, const char* active,
|
||||
return true;
|
||||
}
|
||||
|
||||
#if MESH_RADIO_SWITCH_TUNING
|
||||
bool RadioProfileCLI::validFastImage(const uint8_t* bytes, RadioSwitchTuning& value) const {
|
||||
if (bytes[2] != 1) return false;
|
||||
for (size_t n = 5; n < ImageSize - 4; ++n) if (bytes[n]) return false;
|
||||
|
||||
@@ -88,9 +88,9 @@ class RadioProfileCLI {
|
||||
bool prepareSavedImage(const char* path, const RadioProfileConfig& config,
|
||||
uint16_t preamble, RadioCrossMode cross, int8_t manual_secondary = -1);
|
||||
bool commitSavedImage(const char* path);
|
||||
#if MESH_RADIO_SWITCH_TUNING
|
||||
bool commitImage(const char* staged, const char* active, const char* backup,
|
||||
bool& hold, bool preserve_backup = false);
|
||||
#if MESH_RADIO_SWITCH_TUNING
|
||||
bool validFastImage(const uint8_t* bytes, RadioSwitchTuning& value) const;
|
||||
void loadFastSettings(bool boot = false);
|
||||
bool saveFastSettings(const RadioSwitchTuning& value);
|
||||
|
||||
Reference in new issue
Block a user