Browse Source

Add raw support through web interface

i18n
Rene Hexel 7 years ago
committed by Rene Hexel
parent
commit
243aa8d1f5
2 changed files with 17 additions and 2 deletions
  1. +15
    -0
      code/espurna/rfbridge.ino
  2. +2
    -2
      code/html/index.html

+ 15
- 0
code/espurna/rfbridge.ino View File

@ -421,11 +421,26 @@ void rfbStatus(unsigned char id, bool status) {
String value = rfbRetrieve(id, status);
if (value.length() > 0) {
bool same = _rfbSameOnOff(id);
#ifdef RF_RAW_SUPPORT
byte message[RF_MAX_MESSAGE_SIZE];
int len = _rfbToArray(value.c_str(), message, 0);
if (len == RF_MESSAGE_SIZE && // probably a standard msg
(message[0] != RF_CODE_START || // raw would start with 0xAA
message[1] != RF_CODE_RFOUT_BUCKET || // followed by 0xB0,
message[2] + 4 != len || // needs a valid length,
message[len-1] != RF_CODE_STOP)) { // and finish with 0x55
#else
byte message[RF_MESSAGE_SIZE];
_rfbToArray(value.c_str(), message);
#endif
unsigned char times = RF_SEND_TIMES;
if (same) times = _rfbin ? 0 : 1;
_rfbSend(message, times);
#ifdef RF_RAW_SUPPORT
} else {
_rfbSendRawOnce(message, len); // send a raw message
}
#endif
}
}


+ 2
- 2
code/html/index.html View File

@ -888,7 +888,7 @@
<h2>
Sonoff 433 RF Bridge Configuration<br /><br />
To learn a new code click <strong>LEARN</strong>, the Sonoff RFBridge will beep, then press a button on the remote, the RFBridge will then double beep and the new code should show up. If the device double beeps but the code does not update it has not been properly learnt. Keep trying.<br /><br />
Modify or create new codes manually (all codes must be 18 characters long) and then click <strong>SAVE</strong> to store them in the device memory. If your controlled device uses the same code to switch ON and OFF, learn the code with the ON button and copy paste it to the OFF input box, then click SAVE on the last one to store the value.<br /><br />
Modify or create new codes manually (18 characters standard, up to 116 raw) and then click <strong>SAVE</strong> to store them in the device memory. If your controlled device uses the same code to switch ON and OFF, learn the code with the ON button and copy paste it to the OFF input box, then click SAVE on the last one to store the value.<br /><br />
Delete any code clicking the <strong>FORGET</strong> button.
</h2>
</div>
@ -922,7 +922,7 @@
<div class="pure-g">
<div class="pure-u-1 pure-u-lg-1-4"><label>Switch OFF</label></div>
<input class="pure-u-1 pure-u-lg-1-3" type="text" maxlength="18" name="rfbcode" data-id="1" data-status="0" />
<input class="pure-u-1 pure-u-lg-1-3" type="text" maxlength="116" name="rfbcode" data-id="1" data-status="0" />
<div class="pure-u-1-3 pure-u-lg-1-8"><button type="button" class="pure-u-23-24 pure-button button-rfb-learn">LEARN</button></div>
<div class="pure-u-1-3 pure-u-lg-1-8"><button type="button" class="pure-u-23-24 pure-button button-rfb-send">SAVE</button></div>
<div class="pure-u-1-3 pure-u-lg-1-8"><button type="button" class="pure-u-23-24 pure-button button-rfb-forget">FORGET</button></div>


Loading…
Cancel
Save