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
|
|
@ -1973,13 +1973,16 @@ class Somfy {
|
|||
let config = ProtoViews.radio(proto.schema, radio);
|
||||
ui.toElement(document.getElementById('divTransceiverSettings'), { transceiver: { config: config } });
|
||||
document.getElementById('divRadioError').style.display = config.radioInit ? 'none' : '';
|
||||
this.radioPinsFixed = !!config.fixedPins;
|
||||
ProtoViews.showRadioPins(document, this.radioPinsFixed);
|
||||
this.checkBootPins();
|
||||
});
|
||||
}
|
||||
// Warns of radio pins that can stop the board booting (issue #34).
|
||||
checkBootPins() {
|
||||
let trans = ui.fromElement(document.getElementById('divTransceiverSettings')).transceiver;
|
||||
let warnings = BootPins.radioWarnings(chipModel(), trans.config);
|
||||
// The board's wiring is not the user's to move, so there is nothing to warn of.
|
||||
let warnings = this.radioPinsFixed ? [] : BootPins.radioWarnings(chipModel(), trans.config);
|
||||
let div = document.getElementById('divRadioBootPins');
|
||||
div.innerText = warnings.join('\n');
|
||||
div.style.display = warnings.length > 0 ? '' : 'none';
|
||||
|
|
@ -1993,7 +1996,7 @@ class Somfy {
|
|||
ui.errorMessage('You must select a radio type.');
|
||||
valid = false;
|
||||
}
|
||||
// Check to make sure no pins were duplicated and defined
|
||||
// Check to make sure no pins were duplicated and defined. The board's own wiring is not checked.
|
||||
if (valid) {
|
||||
let fnValDup = (o, name) => {
|
||||
let val = o[name];
|
||||
|
|
@ -2022,12 +2025,12 @@ class Somfy {
|
|||
}
|
||||
return true;
|
||||
};
|
||||
if (valid) valid = fnValDup(trans.config, 'SCKPin');
|
||||
if (valid) valid = fnValDup(trans.config, 'CSNPin');
|
||||
if (valid) valid = fnValDup(trans.config, 'MOSIPin');
|
||||
if (valid) valid = fnValDup(trans.config, 'MISOPin');
|
||||
if (valid) valid = fnValDup(trans.config, 'TXPin');
|
||||
if (valid) valid = fnValDup(trans.config, 'RXPin');
|
||||
if (valid && !this.radioPinsFixed) valid = fnValDup(trans.config, 'SCKPin');
|
||||
if (valid && !this.radioPinsFixed) valid = fnValDup(trans.config, 'CSNPin');
|
||||
if (valid && !this.radioPinsFixed) valid = fnValDup(trans.config, 'MOSIPin');
|
||||
if (valid && !this.radioPinsFixed) valid = fnValDup(trans.config, 'MISOPin');
|
||||
if (valid && !this.radioPinsFixed) valid = fnValDup(trans.config, 'TXPin');
|
||||
if (valid && !this.radioPinsFixed) valid = fnValDup(trans.config, 'RXPin');
|
||||
if (valid) {
|
||||
sendOp('saveSettings', ProtoViews.radioSave(trans.config), (err) => {
|
||||
if (err) ui.serviceError(err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue