diff --git a/data-src/index.js b/data-src/index.js
index 3b6326e..f3e548d 100644
--- a/data-src/index.js
+++ b/data-src/index.js
@@ -418,6 +418,9 @@ function sendEdit(name, fields, target, cb) {
// A command's repeat count, when the caller gave one.
function repeatOf(repeat) { return typeof repeat === 'number' ? repeat : undefined; }
function gone(what) { ui.errorMessage(`The ${what} is no longer there.`); }
+// The chip model the header sent: '' for the original ESP32, then s3, p4es
+// and so on.
+function chipModel() { return document.getElementById('divContainer').getAttribute('data-chipmodel') || ''; }
// The lists redraw from the model after events, a burst of them at once.
// While the socket is down they wait for the next sync.
var renderPending = {};
@@ -1601,7 +1604,7 @@ class Wifi {
this.onETHBoardTypeChanged(document.getElementById('selETHBoardType'));
this.initialized = true;
}
- isP4() { return (document.getElementById('divContainer').getAttribute('data-chipmodel') || '').startsWith('p4'); }
+ isP4() { return chipModel().startsWith('p4'); }
clockModes() { return this.isP4() ? this.ethClockModesP4 : this.ethClockModes; }
// The board presets, clock modes and pins of the chip: the ESP32's or the
// P4's. The chip comes with the sync, after init().
@@ -1976,8 +1979,7 @@ class Somfy {
// 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 warnings = BootPins.radioWarnings(chipModel(), trans.config);
let div = document.getElementById('divRadioBootPins');
div.innerText = warnings.join('\n');
div.style.display = warnings.length > 0 ? '' : 'none';
@@ -2753,7 +2755,7 @@ class Somfy {
loadPins(type, sel, opt) {
while (sel.firstChild) sel.removeChild(sel.firstChild);
- let cm = document.getElementById('divContainer').getAttribute('data-chipmodel');
+ let cm = chipModel();
// The pre-v3 P4 build has the same pins.
if (cm === 'p4es') cm = 'p4';
let pm = this.pinMaps.find(x => x.name === cm) || { name: '', maxPins: 39, inputs: [], outputs: [] };
@@ -4200,7 +4202,7 @@ class Firmware {
div.style.display = '';
}
updateFirmware() {
- let chip = document.getElementById('divContainer').getAttribute('data-chipmodel') || '';
+ let chip = chipModel();
// Firmware from before the field leaves it out: undefined, not false.
if (proto.model.header.hasOtaSlot === false) {
ui.infoMessage(`This device has no OTA slot, so its firmware is flashed over USB with SomfyController.onboard.esp32${chip}.bin, from the release's SomfyController.onboard.esp32${chip}.bin.zip. That image holds the web UI and an empty configuration too, so take a backup first and restore it afterwards.`);
@@ -4223,7 +4225,7 @@ class Firmware {
let div = this.createFileUploader('/updateApplication');
general.reloadApp = true;
let inst = div.querySelector('div[id=divInstText]');
- let chip = document.getElementById('divContainer').getAttribute('data-chipmodel') || '';
+ let chip = chipModel();
inst.innerHTML = `
Select a binary file [SomfyController.littlefs.esp32${chip}.bin] containing the littlefs data for the application then press the Upload File button.
`;
if (this.isMobile()) {
inst.innerHTML += `WARNING
`;
diff --git a/data-src/js/pins.js b/data-src/js/pins.js
index c1c55fe..145ce0c 100644
--- a/data-src/js/pins.js
+++ b/data-src/js/pins.js
@@ -1,6 +1,8 @@
// 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).
+// Keep the pins, the radio pins checked and the shared RX/TX rule in step
+// with that file.
// The minify step joins this file into index.js; Node loads it on its own for
// the tests (test/js).
class BootPins {
@@ -9,7 +11,7 @@ class BootPins {
static radioWarnings(chipModel, config) {
const chip = BootPins.CHIPS[chipModel || ''] || {};
const warnings = [];
- for (const [field, name] of BootPins.RADIO) {
+ for (const [field, name] of BootPins.RADIO_PINS) {
const pin = config[field];
if (field === 'RXPin' && pin === config.TXPin) continue;
const effect = chip[pin];
@@ -32,5 +34,5 @@ BootPins.CHIPS = {
// 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']];
+BootPins.RADIO_PINS = [['TXPin', 'TX'], ['RXPin', 'RX'], ['MISOPin', 'MISO']];
if (typeof module !== 'undefined' && module.exports) module.exports = { BootPins };
diff --git a/src/BootPins.h b/src/BootPins.h
index b02004f..0809623 100644
--- a/src/BootPins.h
+++ b/src/BootPins.h
@@ -9,7 +9,9 @@
// the firmware. The ROM reads them before any code runs, so a radio that
// drives one at power-up stops the board booting until EN is pressed (issue
// #34). The strapping pins that only pick a download mode, quiet the boot
-// log or set the SDIO timing aren't listed. web UI: data-src/js/pins.js.
+// log or set the SDIO timing aren't listed. The web UI has the same pins in
+// data-src/js/pins.js, and checks the same radio pins as
+// transceiver_config_t::apply(): keep the three in step.
//
// Returns what the pin does at reset, or nullptr for a pin that can't stop
// the boot.
diff --git a/src/ConfigRecords.h b/src/ConfigRecords.h
index 54c6b73..582e14f 100644
--- a/src/ConfigRecords.h
+++ b/src/ConfigRecords.h
@@ -183,7 +183,7 @@ struct trans_record_t {
uint8_t MOSIPin = 23;
uint8_t MISOPin = 19;
uint8_t TXPin = 13;
- uint8_t RXPin = 12;
+ uint8_t RXPin = 35;
float frequency = 433.42;
float rxBandwidth = 99.97;
float deviation = 47.60;
diff --git a/src/Transceiver.cpp b/src/Transceiver.cpp
index b5d671e..74967ac 100644
--- a/src/Transceiver.cpp
+++ b/src/Transceiver.cpp
@@ -605,7 +605,7 @@ void transceiver_config_t::apply() {
ESP_LOGD(TAG, "Applying radio settings - Setting Data Pins RX:%u TX:%u", this->RXPin, this->TXPin);
// The 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.
+ // is low. The web UI checks the same (data-src/js/pins.js).
warnBootPin("TX", this->TXPin);
if(this->RXPin != this->TXPin) warnBootPin("RX", this->RXPin);
warnBootPin("MISO", this->MISOPin);
diff --git a/test/js/pins.test.js b/test/js/pins.test.js
index 2c80d15..cd0a391 100644
--- a/test/js/pins.test.js
+++ b/test/js/pins.test.js
@@ -38,7 +38,7 @@ test('MISO and TX warn, the pins the radio only reads do not', () => {
});
test('the pre-v3 P4 has the P4 pins', () => {
- assert.deepEqual(BootPins.radioWarnings('p4es', { SCKPin: 27, CSNPin: 46, MOSIPin: 32, MISOPin: 33, TXPin: 2, RXPin: 35 }),
- BootPins.radioWarnings('p4', { SCKPin: 27, CSNPin: 46, MOSIPin: 32, MISOPin: 33, TXPin: 2, RXPin: 35 }));
- assert.equal(BootPins.radioWarnings('p4', { SCKPin: 27, CSNPin: 46, MOSIPin: 32, MISOPin: 33, TXPin: 2, RXPin: 35 }).length, 1);
+ const p4 = { SCKPin: 27, CSNPin: 46, MOSIPin: 32, MISOPin: 33, TXPin: 2, RXPin: 35 };
+ assert.equal(BootPins.radioWarnings('p4', p4).length, 1);
+ assert.deepEqual(BootPins.radioWarnings('p4es', p4), BootPins.radioWarnings('p4', p4));
});