6.2.1.3 Add SerialSend5

6.2.1.4 20180916
 * Add command SerialSend5 to send raw serial data like "A5074100545293"
 * Update MCP230xx driver
 * Update Czech translation
 * Update MP3 driver (#3800)
 * Add userid/password option to decode-status.py (#3796)
 * Fix syslog when emulation is selected (#2109, #3784)
 * Fix Pzem2 compilation error (#3766, #3767)
This commit is contained in:
Theo Arends 2018-09-16 16:09:00 +02:00
parent 2862ba739c
commit bf7dcb8eec
6 changed files with 38 additions and 26 deletions

View File

@ -1,10 +1,19 @@
/* 6.2.1.3 20180907 /* 6.2.1.4 20180916
* Add command SerialSend5 to send raw serial data like "A5074100545293"
* Update MCP230xx driver
* Update Czech translation
* Update MP3 driver (#3800)
* Add userid/password option to decode-status.py (#3796)
* Fix syslog when emulation is selected (#2109, #3784)
* Fix Pzem2 compilation error (#3766, #3767)
*
* 6.2.1.3 20180907
* Change web Configure Module GPIO drop down list order for better readability * Change web Configure Module GPIO drop down list order for better readability
* Fix showing Period Power in energy threshold messages * Fix showing Period Power in energy threshold messages
* Fix ButtonRetain to not use default topic for clearing retain messages (#3737) * Fix ButtonRetain to not use default topic for clearing retain messages (#3737)
* Add sleep to Nova Fitness SDS01X sensor (#2841, #3724, #3749) * Add sleep to Nova Fitness SDS01X sensor (#2841, #3724, #3749)
* Add Analog input AD0 enabled to sonoff-sensors.bin (#3756, #3757) * Add Analog input AD0 enabled to sonoff-sensors.bin (#3756, #3757)
* Add Support to Xiaomi-Phillips Bulbs * Add Support for Xiaomi-Philips Bulbs (#3787)
* *
* 6.2.1.2 20180906 * 6.2.1.2 20180906
* Fix KNX PA exception. Regression from 6.2.1 buffer overflow caused by subStr() (#3700, #3710) * Fix KNX PA exception. Regression from 6.2.1 buffer overflow caused by subStr() (#3700, #3710)

View File

@ -969,22 +969,25 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
} }
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.baudrate * 1200); snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.baudrate * 1200);
} }
else if ((CMND_SERIALSEND == command_code) && (index > 0) && (index <= 4)) { else if ((CMND_SERIALSEND == command_code) && (index > 0) && (index <= 5)) {
SetSeriallog(LOG_LEVEL_NONE); SetSeriallog(LOG_LEVEL_NONE);
Settings.flag.mqtt_serial = 1; Settings.flag.mqtt_serial = 1;
Settings.flag.mqtt_serial_raw = (4 == index) ? 1 : 0; Settings.flag.mqtt_serial_raw = (index > 3) ? 1 : 0;
if (data_len > 0) { if (data_len > 0) {
if (1 == index) { if (1 == index) {
Serial.printf("%s\n", dataBuf); Serial.printf("%s\n", dataBuf); // "Hello Tiger\n"
} }
else if (2 == index || 4 == index) { else if (2 == index || 4 == index) {
for (int i = 0; i < data_len; i++) { for (int i = 0; i < data_len; i++) {
Serial.write(dataBuf[i]); Serial.write(dataBuf[i]); // "Hello Tiger" or "A0"
} }
} }
else if (3 == index) { else if (3 == index) {
uint16_t dat_len = data_len; uint16_t dat_len = data_len;
Serial.printf("%s", Unescape(dataBuf, &dat_len)); Serial.printf("%s", Unescape(dataBuf, &dat_len)); // "Hello\f"
}
else if (5 == index) {
SerialSendRaw(dataBuf, data_len); // "AA004566"
} }
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE);
} }

View File

@ -20,7 +20,7 @@
#ifndef _SONOFF_VERSION_H_ #ifndef _SONOFF_VERSION_H_
#define _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_
#define VERSION 0x06020103 #define VERSION 0x06020104
#define D_PROGRAMNAME "Sonoff-Tasmota" #define D_PROGRAMNAME "Sonoff-Tasmota"
#define D_AUTHOR "Theo Arends" #define D_AUTHOR "Theo Arends"

View File

@ -704,6 +704,21 @@ void ClaimSerial()
Settings.baudrate = baudrate / 1200; Settings.baudrate = baudrate / 1200;
} }
void SerialSendRaw(char *codes, int size)
{
char *p;
char stemp[3];
uint8_t code;
while (size > 0) {
snprintf(stemp, sizeof(stemp), codes);
code = strtol(stemp, &p, 16);
Serial.write(code);
size -= 2;
codes += 2;
}
}
uint32_t GetHash(const char *buffer, size_t size) uint32_t GetHash(const char *buffer, size_t size)
{ {
uint32_t hash = 0; uint32_t hash = 0;

View File

@ -342,7 +342,7 @@
//#define USE_SDM630 // Add support for Eastron SDM630-Modbus energy meter (+2k code) //#define USE_SDM630 // Add support for Eastron SDM630-Modbus energy meter (+2k code)
#define SDM630_SPEED 9600 // SDM630-Modbus RS485 serial speed (default: 9600 baud) #define SDM630_SPEED 9600 // SDM630-Modbus RS485 serial speed (default: 9600 baud)
//#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop //#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
// #define MP3_VOLUME 10 // Set the startup volume on init, the range can be 0..30(max) #define MP3_VOLUME 10 // Set the startup volume on init, the range can be 0..30(max)
// Power monitoring sensors ----------------------- // Power monitoring sensors -----------------------
#define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code) #define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code)

View File

@ -199,21 +199,6 @@ uint8_t SnfBrUpdateInit()
/********************************************************************************************/ /********************************************************************************************/
void SonoffBridgeSendRaw(char *codes, int size)
{
char *p;
char stemp[3];
uint8_t code;
while (size > 0) {
snprintf(stemp, sizeof(stemp), codes);
code = strtol(stemp, &p, 16);
Serial.write(code);
size -= 2;
codes += 2;
}
}
void SonoffBridgeReceivedRaw() void SonoffBridgeReceivedRaw()
{ {
// Decoding according to https://github.com/Portisch/RF-Bridge-EFM8BB1 // Decoding according to https://github.com/Portisch/RF-Bridge-EFM8BB1
@ -552,11 +537,11 @@ boolean SonoffBridgeCommand()
break; break;
case 192: // 0xC0 - Beep case 192: // 0xC0 - Beep
char beep[] = "AAC000C055"; char beep[] = "AAC000C055";
SonoffBridgeSendRaw(beep, sizeof(beep)); SerialSendRaw(beep, sizeof(beep));
break; break;
} }
} else { } else {
SonoffBridgeSendRaw(XdrvMailbox.data, XdrvMailbox.data_len); SerialSendRaw(XdrvMailbox.data, XdrvMailbox.data_len);
sonoff_bridge_receive_raw_flag = 1; sonoff_bridge_receive_raw_flag = 1;
} }
} }