mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Changes proposed by Theo on PR.
This commit is contained in:
parent
3cf5609ad9
commit
d8e892a0de
@ -211,8 +211,8 @@
|
|||||||
#define D_JSON_IMPORT "Import"
|
#define D_JSON_IMPORT "Import"
|
||||||
#define D_JSON_EXPORT "Export"
|
#define D_JSON_EXPORT "Export"
|
||||||
#define D_JSON_TOTAL_ACTIVE "TotalActive"
|
#define D_JSON_TOTAL_ACTIVE "TotalActive"
|
||||||
#define D_JSON_SIGNALSTRENGTH "Signal Strength"
|
#define D_JSON_SIGNALSTRENGTH "SignalStrength"
|
||||||
#define D_JSON_CHIPTEMPERATURE "Chip Temperature"
|
#define D_JSON_CHIPTEMPERATURE "ChipTemperature"
|
||||||
|
|
||||||
#define D_RSLT_ENERGY "ENERGY"
|
#define D_RSLT_ENERGY "ENERGY"
|
||||||
#define D_RSLT_HASS_STATE "HASS_STATE"
|
#define D_RSLT_HASS_STATE "HASS_STATE"
|
||||||
|
@ -92,12 +92,7 @@ struct xsns_88_tfminiplus
|
|||||||
} tfminiplus_sensor;
|
} tfminiplus_sensor;
|
||||||
|
|
||||||
// Software and hardware serial pointers
|
// Software and hardware serial pointers
|
||||||
#ifdef ESP8266
|
|
||||||
TasmotaSerial *TfmpSerial = nullptr;
|
TasmotaSerial *TfmpSerial = nullptr;
|
||||||
#endif // ESP8266
|
|
||||||
#ifdef ESP32
|
|
||||||
HardwareSerial *TfmpSerial = nullptr;
|
|
||||||
#endif // ESP32
|
|
||||||
|
|
||||||
void TfmpInit(void)
|
void TfmpInit(void)
|
||||||
{
|
{
|
||||||
@ -105,7 +100,6 @@ void TfmpInit(void)
|
|||||||
{
|
{
|
||||||
if (PinUsed(GPIO_TFMINIPLUS_RX) && PinUsed(GPIO_TFMINIPLUS_TX))
|
if (PinUsed(GPIO_TFMINIPLUS_RX) && PinUsed(GPIO_TFMINIPLUS_TX))
|
||||||
{
|
{
|
||||||
#ifdef ESP8266
|
|
||||||
TfmpSerial = new TasmotaSerial(Pin(GPIO_TFMINIPLUS_RX), Pin(GPIO_TFMINIPLUS_TX), 1);
|
TfmpSerial = new TasmotaSerial(Pin(GPIO_TFMINIPLUS_RX), Pin(GPIO_TFMINIPLUS_TX), 1);
|
||||||
if (TfmpSerial->begin(BAUDRATE))
|
if (TfmpSerial->begin(BAUDRATE))
|
||||||
{
|
{
|
||||||
@ -116,12 +110,6 @@ void TfmpInit(void)
|
|||||||
tfminiplus_sensor.ready = true;
|
tfminiplus_sensor.ready = true;
|
||||||
TfmpSerial->flush();
|
TfmpSerial->flush();
|
||||||
}
|
}
|
||||||
#endif // ESP8266
|
|
||||||
#ifdef ESP32
|
|
||||||
TfmpSerial = new HardwareSerial(2);
|
|
||||||
TfmpSerial->begin(BAUDRATE, SERIAL_8N1, Pin(GPIO_TFMINIPLUS_RX), Pin(GPIO_TFMINIPLUS_TX));
|
|
||||||
TfmpSerial->flush();
|
|
||||||
#endif // ESP32
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,7 +158,7 @@ void TfmpProcessSerialData (void)
|
|||||||
while (TfmpSerial->available() > 0)
|
while (TfmpSerial->available() > 0)
|
||||||
{
|
{
|
||||||
data = TfmpSerial->read();
|
data = TfmpSerial->read();
|
||||||
dataReady = addData((char)data);
|
dataReady = TfmpAddData((char)data);
|
||||||
if (dataReady)
|
if (dataReady)
|
||||||
{
|
{
|
||||||
TfmpProcessData();
|
TfmpProcessData();
|
||||||
@ -179,7 +167,7 @@ void TfmpProcessSerialData (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool addData(char nextChar)
|
bool TfmpAddData(char nextChar)
|
||||||
{
|
{
|
||||||
// Buffer position
|
// Buffer position
|
||||||
static uint8_t currentIndex = 0;
|
static uint8_t currentIndex = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user