mirror of https://github.com/arendst/Tasmota.git
Minor refactor
This commit is contained in:
parent
f8104cacdd
commit
531c38b231
|
@ -410,10 +410,9 @@ void solaxX1SnsInit(void)
|
||||||
protocolStatus.status = 0b00100000; // hasAddress
|
protocolStatus.status = 0b00100000; // hasAddress
|
||||||
|
|
||||||
solaxX1Serial = new TasmotaSerial(pin[GPIO_SOLAXX1_RX], pin[GPIO_SOLAXX1_TX], 1);
|
solaxX1Serial = new TasmotaSerial(pin[GPIO_SOLAXX1_RX], pin[GPIO_SOLAXX1_TX], 1);
|
||||||
if (solaxX1Serial->begin(SOLAXX1_SPEED))
|
if (solaxX1Serial->begin(SOLAXX1_SPEED)) {
|
||||||
{
|
|
||||||
if (solaxX1Serial->hardwareSerial()) { ClaimSerial(); }
|
if (solaxX1Serial->hardwareSerial()) { ClaimSerial(); }
|
||||||
}else {
|
} else {
|
||||||
energy_flg = ENERGY_NONE;
|
energy_flg = ENERGY_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -503,17 +502,10 @@ bool Xnrg12(uint8_t function)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
switch (function)
|
switch (function) {
|
||||||
{
|
|
||||||
case FUNC_EVERY_250_MSECOND:
|
case FUNC_EVERY_250_MSECOND:
|
||||||
if (uptime > 4) { solaxX1250MSecond(); }
|
if (uptime > 4) { solaxX1250MSecond(); }
|
||||||
break;
|
break;
|
||||||
case FUNC_INIT:
|
|
||||||
solaxX1SnsInit();
|
|
||||||
break;
|
|
||||||
case FUNC_PRE_INIT:
|
|
||||||
solaxX1DrvInit();
|
|
||||||
break;
|
|
||||||
case FUNC_JSON_APPEND:
|
case FUNC_JSON_APPEND:
|
||||||
solaxX1Show(1);
|
solaxX1Show(1);
|
||||||
break;
|
break;
|
||||||
|
@ -522,6 +514,12 @@ bool Xnrg12(uint8_t function)
|
||||||
solaxX1Show(0);
|
solaxX1Show(0);
|
||||||
break;
|
break;
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
|
case FUNC_INIT:
|
||||||
|
solaxX1SnsInit();
|
||||||
|
break;
|
||||||
|
case FUNC_PRE_INIT:
|
||||||
|
solaxX1DrvInit();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue