mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
Add the ability to modify the base radio frequency.
This commit is contained in:
parent
33fc37fa3d
commit
cd173525b1
5 changed files with 21 additions and 5 deletions
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
extern Preferences pref;
|
extern Preferences pref;
|
||||||
|
|
||||||
#define SHADE_HDR_VER 7
|
#define SHADE_HDR_VER 8
|
||||||
#define SHADE_HDR_SIZE 16
|
#define SHADE_HDR_SIZE 16
|
||||||
#define SHADE_REC_SIZE 232
|
#define SHADE_REC_SIZE 236
|
||||||
|
|
||||||
bool ConfigFile::begin(const char* filename, bool readOnly) {
|
bool ConfigFile::begin(const char* filename, bool readOnly) {
|
||||||
this->file = LittleFS.open(filename, readOnly ? "r" : "w");
|
this->file = LittleFS.open(filename, readOnly ? "r" : "w");
|
||||||
|
|
@ -58,9 +58,7 @@ bool ConfigFile::seekRecordByIndex(uint16_t ndx) {
|
||||||
if(!this->file) {
|
if(!this->file) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(((this->header.recordSize * ndx) + this->header.length) > this->file.size()) {
|
if(((this->header.recordSize * ndx) + this->header.length) > this->file.size()) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool ConfigFile::readString(char *buff, size_t len) {
|
bool ConfigFile::readString(char *buff, size_t len) {
|
||||||
|
|
@ -307,6 +305,7 @@ bool ShadeConfigFile::loadFile(SomfyShadeController *s, const char *filename) {
|
||||||
if(this->header.version < 5 && j == 4) break; // Prior to version 5 we only supported 5 linked remotes.
|
if(this->header.version < 5 && j == 4) break; // Prior to version 5 we only supported 5 linked remotes.
|
||||||
}
|
}
|
||||||
shade->lastRollingCode = this->readUInt16(0);
|
shade->lastRollingCode = this->readUInt16(0);
|
||||||
|
if(this->header.version > 7) shade->flags = this->readUInt8(0);
|
||||||
if(shade->getRemoteAddress() != 0) shade->lastRollingCode = max(pref.getUShort(shade->getRemotePrefId(), shade->lastRollingCode), shade->lastRollingCode);
|
if(shade->getRemoteAddress() != 0) shade->lastRollingCode = max(pref.getUShort(shade->getRemotePrefId(), shade->lastRollingCode), shade->lastRollingCode);
|
||||||
if(this->header.version < 4)
|
if(this->header.version < 4)
|
||||||
shade->myPos = static_cast<float>(this->readUInt8(255));
|
shade->myPos = static_cast<float>(this->readUInt8(255));
|
||||||
|
|
@ -361,6 +360,7 @@ bool ShadeConfigFile::writeShadeRecord(SomfyShade *shade) {
|
||||||
this->writeUInt32(rem->getRemoteAddress());
|
this->writeUInt32(rem->getRemoteAddress());
|
||||||
}
|
}
|
||||||
this->writeUInt16(shade->lastRollingCode);
|
this->writeUInt16(shade->lastRollingCode);
|
||||||
|
this->writeUInt8(shade->flags);
|
||||||
this->writeFloat(shade->myPos, 5);
|
this->writeFloat(shade->myPos, 5);
|
||||||
this->writeFloat(shade->myTiltPos, 5);
|
this->writeFloat(shade->myTiltPos, 5);
|
||||||
this->writeFloat(shade->currentPos, 5);
|
this->writeFloat(shade->currentPos, 5);
|
||||||
|
|
@ -372,6 +372,7 @@ bool ShadeConfigFile::getAppVersion(appver_t &ver) {
|
||||||
char app[15];
|
char app[15];
|
||||||
if(!LittleFS.exists("/appversion")) return false;
|
if(!LittleFS.exists("/appversion")) return false;
|
||||||
File f = LittleFS.open("/appversion", "r");
|
File f = LittleFS.open("/appversion", "r");
|
||||||
|
size_t fsize = f.size();
|
||||||
memset(app, 0x00, sizeof(app));
|
memset(app, 0x00, sizeof(app));
|
||||||
f.read((uint8_t *)app, sizeof(app) - 1);
|
f.read((uint8_t *)app, sizeof(app) - 1);
|
||||||
f.close();
|
f.close();
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -378,6 +378,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="field-group" style="display:inline-block;width:auto;min-width:247px;margin-top:-20px;vertical-align:top;">
|
<div class="field-group" style="display:inline-block;width:auto;min-width:247px;margin-top:-20px;vertical-align:top;">
|
||||||
<div class="field-group">
|
<div class="field-group">
|
||||||
|
<input id="slidFrequency" name="frequency" type="range" min="433330" max="433499" step="1" style="width:100%;" oninput="somfy.frequencyChanged(this);" />
|
||||||
|
<label for="slidRxBandwidth" style="display:block;font-size:1em;margin-top:0px;margin-left:7px;">
|
||||||
|
<span>Base Frequency </span>
|
||||||
|
<span style="float:right;display:inline-block;margin-right:7px;">
|
||||||
|
<span id="spanFrequency" style="color:black;"></span><span>MHz</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="field-group" style="margin-top:-10px;">
|
||||||
<input id="slidRxBandwidth" name="rxBandwidth" type="range" min="5803" max="81250" step="1" style="width:100%;" oninput="somfy.rxBandwidthChanged(this);" />
|
<input id="slidRxBandwidth" name="rxBandwidth" type="range" min="5803" max="81250" step="1" style="width:100%;" oninput="somfy.rxBandwidthChanged(this);" />
|
||||||
<label for="slidRxBandwidth" style="display:block;font-size:1em;margin-top:0px;margin-left:7px;">
|
<label for="slidRxBandwidth" style="display:block;font-size:1em;margin-top:0px;margin-left:7px;">
|
||||||
<span>RX Bandwidth </span>
|
<span>RX Bandwidth </span>
|
||||||
|
|
|
||||||
|
|
@ -928,6 +928,8 @@ class Somfy {
|
||||||
document.getElementById('selRadioType').value = somfy.transceiver.config.type;
|
document.getElementById('selRadioType').value = somfy.transceiver.config.type;
|
||||||
document.getElementById('selRadioProto').value = somfy.transceiver.config.proto;
|
document.getElementById('selRadioProto').value = somfy.transceiver.config.proto;
|
||||||
document.getElementById('spanMaxShades').innerText = somfy.maxShades;
|
document.getElementById('spanMaxShades').innerText = somfy.maxShades;
|
||||||
|
document.getElementById('spanFrequency').innerText = (Math.round(somfy.transceiver.config.frequency * 1000) / 1000).fmt('#,##0.000');
|
||||||
|
document.getElementById('slidFrequency').value = Math.round(somfy.transceiver.config.frequency * 1000);
|
||||||
document.getElementById('spanRxBandwidth').innerText = (Math.round(somfy.transceiver.config.rxBandwidth * 100) / 100).fmt('#,##0.00');
|
document.getElementById('spanRxBandwidth').innerText = (Math.round(somfy.transceiver.config.rxBandwidth * 100) / 100).fmt('#,##0.00');
|
||||||
document.getElementById('slidRxBandwidth').value = Math.round(somfy.transceiver.config.rxBandwidth * 100);
|
document.getElementById('slidRxBandwidth').value = Math.round(somfy.transceiver.config.rxBandwidth * 100);
|
||||||
document.getElementById('spanTxPower').innerText = somfy.transceiver.config.txPower;
|
document.getElementById('spanTxPower').innerText = somfy.transceiver.config.txPower;
|
||||||
|
|
@ -971,6 +973,7 @@ class Somfy {
|
||||||
MISOPin: getIntValue('selTransMISOPin'),
|
MISOPin: getIntValue('selTransMISOPin'),
|
||||||
TXPin: getIntValue('selTransTXPin'),
|
TXPin: getIntValue('selTransTXPin'),
|
||||||
RXPin: getIntValue('selTransRXPin'),
|
RXPin: getIntValue('selTransRXPin'),
|
||||||
|
frequency: (Math.round(parseFloat(document.getElementById('spanFrequency').innerText) * 1000)) / 1000,
|
||||||
rxBandwidth: (Math.round(parseFloat(document.getElementById('spanRxBandwidth').innerText) * 100)) / 100,
|
rxBandwidth: (Math.round(parseFloat(document.getElementById('spanRxBandwidth').innerText) * 100)) / 100,
|
||||||
txPower: parseInt(document.getElementById('spanTxPower').innerText, 10),
|
txPower: parseInt(document.getElementById('spanTxPower').innerText, 10),
|
||||||
deviation: (Math.round(parseFloat(document.getElementById('spanDeviation').innerText) * 100)) / 100
|
deviation: (Math.round(parseFloat(document.getElementById('spanDeviation').innerText) * 100)) / 100
|
||||||
|
|
@ -1897,6 +1900,9 @@ class Somfy {
|
||||||
rxBandwidthChanged(el) {
|
rxBandwidthChanged(el) {
|
||||||
document.getElementById('spanRxBandwidth').innerText = (el.value / 100).fmt('#,##0.00');
|
document.getElementById('spanRxBandwidth').innerText = (el.value / 100).fmt('#,##0.00');
|
||||||
};
|
};
|
||||||
|
frequencyChanged(el) {
|
||||||
|
document.getElementById('spanFrequency').innerText = (el.value / 1000).fmt('#,##0.000');
|
||||||
|
}
|
||||||
txPowerChanged(el) {
|
txPowerChanged(el) {
|
||||||
console.log(el.value);
|
console.log(el.value);
|
||||||
let lvls = [-30, -20, -15, -10, -6, 0, 5, 7, 10, 11, 12];
|
let lvls = [-30, -20, -15, -10, -6, 0, 5, 7, 10, 11, 12];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue