mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-26 20:26:32 +00:00
Add HLW8032 8N1
This commit is contained in:
parent
24105a74b2
commit
a4fe1b88f9
@ -825,7 +825,7 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
||||
#endif
|
||||
#ifdef USE_CSE7766
|
||||
AGPIO(GPIO_CSE7766_TX), // CSE7766 Serial interface (S31 and Pow R2)
|
||||
AGPIO(GPIO_CSE7766_RX), // CSE7766 Serial interface (S31 and Pow R2)
|
||||
AGPIO(GPIO_CSE7766_RX) + 2, // CSE7766 Serial interface (S31 and Pow R2) (1 = RX1 (8E1), 2 = RX2 (8N1))
|
||||
#endif
|
||||
#ifdef USE_MCP39F501
|
||||
AGPIO(GPIO_MCP39F5_TX), // MCP39F501 Serial interface (Shelly2)
|
||||
|
@ -225,11 +225,17 @@ void CseEverySecond(void) {
|
||||
|
||||
void CseSnsInit(void) {
|
||||
// Software serial init needs to be done here as earlier (serial) interrupts may lead to Exceptions
|
||||
// CseSerial = new TasmotaSerial(Pin(GPIO_CSE7766_RX), Pin(GPIO_CSE7766_TX), 1);
|
||||
CseSerial = new TasmotaSerial(Pin(GPIO_CSE7766_RX), -1, 1);
|
||||
if (CseSerial->begin(4800, SERIAL_8E1)) {
|
||||
uint32_t pin_rx = Pin(GPIO_CSE7766_RX, GPIO_ANY);
|
||||
// CseSerial = new TasmotaSerial(pin_rx, Pin(GPIO_CSE7766_TX), 1);
|
||||
CseSerial = new TasmotaSerial(pin_rx, -1, 1);
|
||||
|
||||
// 0 (1 = RX1 (8E1)), 1 (2 = RX2 (8N1))
|
||||
uint32_t option = GetPin(pin_rx) - AGPIO(GPIO_CSE7766_RX);
|
||||
uint32_t config = (1 == option) ? SERIAL_8N1 : SERIAL_8E1;
|
||||
if (CseSerial->begin(4800, config)) {
|
||||
if (CseSerial->hardwareSerial()) {
|
||||
SetSerial(4800, TS_SERIAL_8E1);
|
||||
config = (1 == option) ? TS_SERIAL_8N1 : TS_SERIAL_8E1;
|
||||
SetSerial(4800, config);
|
||||
ClaimSerial();
|
||||
}
|
||||
if (0 == Settings->param[P_CSE7766_INVALID_POWER]) {
|
||||
@ -243,8 +249,8 @@ void CseSnsInit(void) {
|
||||
}
|
||||
|
||||
void CseDrvInit(void) {
|
||||
// if (PinUsed(GPIO_CSE7766_RX) && PinUsed(GPIO_CSE7766_TX)) {
|
||||
if (PinUsed(GPIO_CSE7766_RX)) {
|
||||
// if (PinUsed(GPIO_CSE7766_RX, GPIO_ANY) && PinUsed(GPIO_CSE7766_TX)) {
|
||||
if (PinUsed(GPIO_CSE7766_RX, GPIO_ANY)) {
|
||||
Cse.rx_buffer = (uint8_t*)(malloc(CSE_BUFFER_SIZE));
|
||||
if (Cse.rx_buffer != nullptr) {
|
||||
TasmotaGlobal.energy_driver = XNRG_02;
|
||||
|
@ -189,7 +189,7 @@ void We517SnsInit(void) {
|
||||
if (result) {
|
||||
if (2 == result) {
|
||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("ORNO: WE517 HW serial init 8E1 at %d baud"), WE517_SPEED);
|
||||
// Serial.begin(WE517_SPEED, SERIAL_8E1);
|
||||
Serial.begin(WE517_SPEED, SERIAL_8E1);
|
||||
ClaimSerial();
|
||||
}
|
||||
Energy.phase_count = 3;
|
||||
|
Loading…
x
Reference in New Issue
Block a user