mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-11-20 15:52:12 +01:00
Show the fixed radio pins as read-only in the web UI
On the integrated-radio board the firmware replaces any radio pins a client saves with the board's wiring, yet the web UI let the user edit them and reported success. The radio settings now carry fixedPins (wire key fx), sent only where the radio is wired to the board. The web UI disables the six pin selects, shows "Radio wiring is fixed on this board." and skips the pin duplicate and boot-pin checks for them. Generic builds do not send the field, so their behaviour is unchanged, and applyBoardPins() stays as the safety net for old configs and imports. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
31eda550b9
commit
2b3d556729
13 changed files with 109 additions and 15 deletions
|
|
@ -109,6 +109,7 @@ static void writeSettings(ProtoWriter &w, settings_section_t section) {
|
|||
w.add(proto_field_t::txPower, cfg.txPower);
|
||||
w.add(proto_field_t::noiseDetection, cfg.noiseDetection);
|
||||
w.add(proto_field_t::radioInit, cfg.radioInit);
|
||||
writeRadioBoardFields(w, BoardProfile::integratedRadio);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,6 +251,7 @@
|
|||
FIELD(txPower, "tp", 'i', 0) \
|
||||
FIELD(noiseDetection, "nd", 'b', 0) \
|
||||
FIELD(radioInit, "ri", 'b', 0) \
|
||||
FIELD(fixedPins, "fx", 'b', 0) \
|
||||
/* wifiNetworks: each network has ssid, channel and strength as above */ \
|
||||
FIELD(networks, "nw", 'l', 0) \
|
||||
FIELD(macAddress, "ma", 's', 0)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ static settings_section_t sectionOf(settings_part_t part) {
|
|||
// What a save may set. lo..hi is a whole number's range, a number's in
|
||||
// hundredths, and hi a string's longest length: what the setting holds, so the
|
||||
// route's fromJSON neither cuts it short nor wraps it. The has* fields and
|
||||
// radioInit are only ever sent.
|
||||
// radioInit and fixedPins are only ever sent.
|
||||
struct settings_field_t {
|
||||
settings_part_t part;
|
||||
proto_field_t field;
|
||||
|
|
@ -97,6 +97,10 @@ static const settings_field_t *saved(settings_section_t section, proto_field_t f
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void writeRadioBoardFields(ProtoWriter &w, bool pinsFixed) {
|
||||
w.add(proto_field_t::fixedPins, pinsFixed);
|
||||
}
|
||||
|
||||
const char *parseSettingsSection(JsonObjectConst d, settings_section_t §ion) {
|
||||
const char *name = protoString(d, proto_field_t::section);
|
||||
if(!name) return "section is missing";
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ enum class settings_part_t : uint8_t {
|
|||
radio // transceiver_config_t
|
||||
};
|
||||
const char *settingsSectionName(settings_section_t section);
|
||||
// What the radio section says about the board rather than the config:
|
||||
// fixedPins is set where the radio is wired to the board, so the six pins in
|
||||
// the section are the board's and a save can't change them. Left out
|
||||
// otherwise, so a client that doesn't know it never sees it.
|
||||
void writeRadioBoardFields(ProtoWriter &w, bool pinsFixed);
|
||||
// The section that payload d names in section. nullptr when it is good;
|
||||
// otherwise what is wrong with it, for a bad request reply.
|
||||
const char *parseSettingsSection(JsonObjectConst d, settings_section_t §ion);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue