mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: warn of radio pins that can stop the board booting (#34)
GPIO12 is a strapping pin on the original ESP32: high at reset, it powers the flash at 1.8 V. A CC1101 can hold GDO2 high at power-up, so a board with RX on 12 bootloops after a power cut until EN is pressed. It was the default RX pin. - RX defaults to GPIO35 on the original ESP32. Saved settings keep their pins. - The log warns each time the radio starts, and the radio settings show a warning, while TX, RX or MISO is on a pin whose level at reset can stop the chip booting (src/BootPins.h, data-src/js/pins.js). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a92c7a26f6
commit
8a59f51111
10 changed files with 234 additions and 7 deletions
|
|
@ -919,20 +919,21 @@
|
|||
<label for="selTransMOSIPin">MOSI</label>
|
||||
</div>
|
||||
<div class="field-group radioPins">
|
||||
<select id="selTransMISOPin" name="transMISO" data-bind="transceiver.config.MISOPin" data-datatype="int"></select>
|
||||
<select id="selTransMISOPin" name="transMISO" data-bind="transceiver.config.MISOPin" data-datatype="int" onchange="somfy.checkBootPins();"></select>
|
||||
<label for="selTransMISOPin">MISO</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-group1" style="margin-top:-20px;">
|
||||
<div class="field-group radioPins">
|
||||
<select id="selTransTXPin" name="transTX" data-bind="transceiver.config.TXPin" data-datatype="int"></select>
|
||||
<select id="selTransTXPin" name="transTX" data-bind="transceiver.config.TXPin" data-datatype="int" onchange="somfy.checkBootPins();"></select>
|
||||
<label for="selTransTXPin">TX</label>
|
||||
</div>
|
||||
<div class="field-group radioPins">
|
||||
<select id="selTransRXPin" name="transRX" data-bind="transceiver.config.RXPin" data-datatype="int"></select>
|
||||
<select id="selTransRXPin" name="transRX" data-bind="transceiver.config.RXPin" data-datatype="int" onchange="somfy.checkBootPins();"></select>
|
||||
<label for="selTransRXPin">RX</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="divRadioBootPins" style="display:none;color:#e65100;font-size:12px;margin:-14px 0 14px 0;white-space:normal;"></div>
|
||||
<div class="field-group" style="display:inline-block;width:auto;min-width:247px;margin-top:-20px;vertical-align:top;">
|
||||
<div class="field-group">
|
||||
<input id="slidFrequency" name="frequency" type="range" min="433000" max="434399" step="1" style="width:100%;" data-bind="transceiver.config.frequency" data-datatype="float" data-mult="1000" oninput="somfy.frequencyChanged(this);" />
|
||||
|
|
|
|||
|
|
@ -1944,8 +1944,9 @@ class Somfy {
|
|||
this.loadPins('input', document.getElementById('selTransRXPin'));
|
||||
//this.loadSomfy();
|
||||
ui.toElement(document.getElementById('divTransceiverSettings'), {
|
||||
transceiver: { config: { proto: 0, SCKPin: 18, CSNPin: 5, MOSIPin: 23, MISOPin: 19, TXPin: 12, RXPin: 13, frequency: 433.42, rxBandwidth: 97.96, type: 56, deviation: 11.43, txPower: 10, enabled: false, noiseDetection: false } }
|
||||
transceiver: { config: { proto: 0, SCKPin: 18, CSNPin: 5, MOSIPin: 23, MISOPin: 19, TXPin: 13, RXPin: 35, frequency: 433.42, rxBandwidth: 97.96, type: 56, deviation: 11.43, txPower: 10, enabled: false, noiseDetection: false } }
|
||||
});
|
||||
this.checkBootPins();
|
||||
this.loadPins('out', document.getElementById('selShadeGPIOUp'));
|
||||
this.loadPins('out', document.getElementById('selShadeGPIODown'));
|
||||
this.loadPins('out', document.getElementById('selShadeGPIOMy'));
|
||||
|
|
@ -1969,8 +1970,18 @@ 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.checkBootPins();
|
||||
});
|
||||
}
|
||||
// Warns of radio pins that can stop the board booting (issue #34).
|
||||
checkBootPins() {
|
||||
let trans = ui.fromElement(document.getElementById('divTransceiverSettings')).transceiver;
|
||||
let chip = document.getElementById('divContainer').getAttribute('data-chipmodel') || '';
|
||||
let warnings = BootPins.radioWarnings(chip, trans.config);
|
||||
let div = document.getElementById('divRadioBootPins');
|
||||
div.innerText = warnings.join('\n');
|
||||
div.style.display = warnings.length > 0 ? '' : 'none';
|
||||
}
|
||||
saveRadio() {
|
||||
let valid = true;
|
||||
let getIntValue = (fld) => { return parseInt(document.getElementById(fld).value, 10); };
|
||||
|
|
|
|||
36
data-src/js/pins.js
Normal file
36
data-src/js/pins.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// The strapping pins whose level at reset can keep each chip from starting
|
||||
// the firmware, as src/BootPins.h has them for the log. A radio that drives
|
||||
// one at power-up stops the board booting until EN is pressed (issue #34).
|
||||
// The minify step joins this file into index.js; Node loads it on its own for
|
||||
// the tests (test/js).
|
||||
class BootPins {
|
||||
// A warning for each of the radio config's pins that can stop the board
|
||||
// booting.
|
||||
static radioWarnings(chipModel, config) {
|
||||
const chip = BootPins.CHIPS[chipModel || ''] || {};
|
||||
const warnings = [];
|
||||
for (const [field, name] of BootPins.RADIO) {
|
||||
const pin = config[field];
|
||||
if (field === 'RXPin' && pin === config.TXPin) continue;
|
||||
const effect = chip[pin];
|
||||
if (effect) warnings.push(`${name} is on GPIO-${pin}, a strapping pin: ${effect}. The radio can hold it there and stop the board booting after a power cut, so move it to another pin.`);
|
||||
}
|
||||
return warnings;
|
||||
}
|
||||
}
|
||||
// By the chip model the header sends, '' for the original ESP32.
|
||||
BootPins.CHIPS = {
|
||||
'': { 0: 'low at reset starts the download mode', 12: 'high at reset powers the flash at 1.8 V' },
|
||||
s2: { 0: 'low at reset starts the download mode', 45: 'high at reset powers the flash at 1.8 V' },
|
||||
s3: { 0: 'low at reset starts the download mode', 45: 'high at reset powers the flash at 1.8 V' },
|
||||
c3: { 9: 'low at reset starts the download mode' },
|
||||
c5: { 28: 'low at reset starts the download mode' },
|
||||
c6: { 9: 'low at reset starts the download mode' },
|
||||
p4: { 35: 'low at reset starts the download mode' },
|
||||
p4es: { 35: 'low at reset starts the download mode' }
|
||||
};
|
||||
// The radio pins the CC1101 drives at power-up, before it is set up: GDO0
|
||||
// puts out a clock, GDO2 CHIP_RDYn, and SO follows CHIP_RDYn while CSN is
|
||||
// low.
|
||||
BootPins.RADIO = [['TXPin', 'TX'], ['RXPin', 'RX'], ['MISOPin', 'MISO']];
|
||||
if (typeof module !== 'undefined' && module.exports) module.exports = { BootPins };
|
||||
Loading…
Add table
Add a link
Reference in a new issue