mirror of https://github.com/arendst/Tasmota.git
Prep support ESP32 enum SerialConfig
This commit is contained in:
parent
efa7ae492e
commit
326c605122
|
@ -129,7 +129,7 @@ uint32_t analogGetTimerFrequency(uint8_t timer);
|
||||||
#define os_delay_us ets_delay_us
|
#define os_delay_us ets_delay_us
|
||||||
// Serial minimal type to hold the config
|
// Serial minimal type to hold the config
|
||||||
typedef int SerConfu8;
|
typedef int SerConfu8;
|
||||||
typedef int SerialConfig;
|
//typedef int SerialConfig; // Will be replaced enum in esp32_hal-uart.h (#7926)
|
||||||
|
|
||||||
//
|
//
|
||||||
// UDP
|
// UDP
|
||||||
|
|
|
@ -3142,7 +3142,7 @@ next_line:
|
||||||
|
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
||||||
SerialConfig smode = SERIAL_8N1;
|
uint32_t smode = SERIAL_8N1;
|
||||||
|
|
||||||
if (mp->sopt & 0xf0) {
|
if (mp->sopt & 0xf0) {
|
||||||
// new serial config
|
// new serial config
|
||||||
|
@ -3178,14 +3178,14 @@ next_line:
|
||||||
mp->meter_ss->flush();
|
mp->meter_ss->flush();
|
||||||
}
|
}
|
||||||
if (mp->meter_ss->hardwareSerial()) {
|
if (mp->meter_ss->hardwareSerial()) {
|
||||||
Serial.begin(mp->params, smode);
|
Serial.begin(mp->params, (SerialConfig)smode); // void HardwareSerial::begin(unsigned long baud, SerialConfig config, SerialMode mode, uint8_t tx_pin, bool invert)
|
||||||
ClaimSerial();
|
ClaimSerial();
|
||||||
//Serial.setRxBufferSize(512);
|
//Serial.setRxBufferSize(512);
|
||||||
}
|
}
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
mp->meter_ss->begin(mp->params, smode, mp->srcpin, mp->trxpin);
|
mp->meter_ss->begin(mp->params, smode, mp->srcpin, mp->trxpin); // void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert, unsigned long timeout_ms, uint8_t rxfifo_full_thrhd)
|
||||||
#ifdef USE_ESP32_SW_SERIAL
|
#ifdef USE_ESP32_SW_SERIAL
|
||||||
mp->meter_ss->setRxBufferSize(mp->sibsiz);
|
mp->meter_ss->setRxBufferSize(mp->sibsiz);
|
||||||
#endif
|
#endif
|
||||||
|
@ -3293,7 +3293,7 @@ uint32_t SML_Write(int32_t meter, char *hstr) {
|
||||||
hstr++;
|
hstr++;
|
||||||
// currently only 8 bits and ignore stopbits
|
// currently only 8 bits and ignore stopbits
|
||||||
hstr++;
|
hstr++;
|
||||||
SerialConfig smode;
|
uint32_t smode;
|
||||||
switch (*hstr) {
|
switch (*hstr) {
|
||||||
case 'N':
|
case 'N':
|
||||||
smode = SERIAL_8N1;
|
smode = SERIAL_8N1;
|
||||||
|
@ -3307,9 +3307,9 @@ uint32_t SML_Write(int32_t meter, char *hstr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
Serial.begin(baud, smode);
|
Serial.begin(baud, (SerialConfig)smode); // void HardwareSerial::begin(unsigned long baud, SerialConfig config, SerialMode mode, uint8_t tx_pin, bool invert)
|
||||||
#else
|
#else
|
||||||
meter_desc[meter].meter_ss->begin(baud, smode, sml_globs.mp[meter].srcpin, sml_globs.mp[meter].trxpin);
|
meter_desc[meter].meter_ss->begin(baud, smode, sml_globs.mp[meter].srcpin, sml_globs.mp[meter].trxpin); // void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert, unsigned long timeout_ms, uint8_t rxfifo_full_thrhd)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue