mirror of https://github.com/arendst/Tasmota.git
Merge pull request #14305 from SteWers/Solax-X1-RTS
[Solax X1] RTS support and offline status
This commit is contained in:
commit
79bcdd0fff
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "ZigBee RST"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 TX"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 RX"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -735,6 +735,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee - RESET"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 - TX"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 - RX"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 - RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon - TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon - RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 - RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -737,6 +737,7 @@
|
|||
#define D_SENSOR_ZIGBEE_RST "Zigbee Rst"
|
||||
#define D_SENSOR_SOLAXX1_TX "SolaxX1 Tx"
|
||||
#define D_SENSOR_SOLAXX1_RX "SolaxX1 Rx"
|
||||
#define D_SENSOR_SOLAXX1_RTS "SolaxX1 RTS"
|
||||
#define D_SENSOR_IBEACON_TX "iBeacon TX"
|
||||
#define D_SENSOR_IBEACON_RX "iBeacon RX"
|
||||
#define D_SENSOR_RDM6300_RX "RDM6300 RX"
|
||||
|
|
|
@ -177,6 +177,7 @@ enum UserSelectablePins {
|
|||
GPIO_HM330X_SET, // HM330X SET pin (sleep when low)
|
||||
GPIO_HEARTBEAT, GPIO_HEARTBEAT_INV,
|
||||
GPIO_SHIFT595_SRCLK, GPIO_SHIFT595_RCLK, GPIO_SHIFT595_OE, GPIO_SHIFT595_SER, // 74x595 Shift register
|
||||
GPIO_SOLAXX1_RTS, // Solax Inverter Serial interface
|
||||
GPIO_SENSOR_END };
|
||||
|
||||
enum ProgramSelectablePins {
|
||||
|
@ -373,8 +374,8 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_BL0942_RX "|"
|
||||
D_SENSOR_HM330X_SET "|"
|
||||
D_SENSOR_HEARTBEAT "|" D_SENSOR_HEARTBEAT "_i|"
|
||||
|
||||
D_GPIO_SHIFT595_SRCLK "|" D_GPIO_SHIFT595_RCLK "|" D_GPIO_SHIFT595_OE "|" D_GPIO_SHIFT595_SER "|"
|
||||
D_SENSOR_SOLAXX1_RTS "|"
|
||||
;
|
||||
|
||||
const char kSensorNamesFixed[] PROGMEM =
|
||||
|
@ -711,6 +712,7 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
|||
#ifdef USE_SOLAX_X1
|
||||
AGPIO(GPIO_SOLAXX1_TX), // Solax Inverter tx pin
|
||||
AGPIO(GPIO_SOLAXX1_RX), // Solax Inverter rx pin
|
||||
AGPIO(GPIO_SOLAXX1_RTS), // Solax Inverter RTS pin
|
||||
#endif // USE_SOLAX_X1
|
||||
#ifdef USE_LE01MR
|
||||
AGPIO(GPIO_LE01MR_TX), // F7F LE-01MR energy meter tx pin
|
||||
|
|
|
@ -83,7 +83,7 @@ union {
|
|||
};
|
||||
} ErrCode;
|
||||
|
||||
const char kSolaxMode[] PROGMEM = D_WAITING "|" D_CHECKING "|" D_WORKING "|" D_FAILURE;
|
||||
const char kSolaxMode[] PROGMEM = D_WAITING "|" D_CHECKING "|" D_WORKING "|" D_FAILURE "|" D_OFF;
|
||||
|
||||
const char kSolaxError[] PROGMEM =
|
||||
D_SOLAX_ERROR_0 "|" D_SOLAX_ERROR_1 "|" D_SOLAX_ERROR_2 "|" D_SOLAX_ERROR_3 "|" D_SOLAX_ERROR_4 "|" D_SOLAX_ERROR_5 "|"
|
||||
|
@ -155,10 +155,17 @@ void solaxX1_RS485Send(uint16_t msgLen)
|
|||
solaxX1Serial->read();
|
||||
}
|
||||
|
||||
if (PinUsed(GPIO_SOLAXX1_RTS)) {
|
||||
digitalWrite(Pin(GPIO_SOLAXX1_RTS), HIGH);
|
||||
}
|
||||
solaxX1Serial->flush();
|
||||
solaxX1Serial->write(message, msgLen);
|
||||
solaxX1Serial->write(highByte(crc));
|
||||
solaxX1Serial->write(lowByte(crc));
|
||||
if (PinUsed(GPIO_SOLAXX1_RTS)) {
|
||||
digitalWrite(Pin(GPIO_SOLAXX1_RTS), LOW);
|
||||
}
|
||||
|
||||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, message, msgLen);
|
||||
}
|
||||
|
||||
|
@ -363,8 +370,8 @@ void solaxX1250MSecond(void) // Every 250 milliseconds
|
|||
Energy.data_valid[0] = ENERGY_WATCHDOG;
|
||||
|
||||
solaxX1.temperature = solaxX1.dc1_voltage = solaxX1.dc2_voltage = solaxX1.dc1_current = solaxX1.dc2_current = solaxX1.dc1_power = 0;
|
||||
solaxX1.dc2_power = solaxX1.status = Energy.current[0] = Energy.voltage[0] = Energy.frequency[0] = Energy.active_power[0] = 0;
|
||||
//solaxX1.energy_today = solaxX1.runtime_total = 0;
|
||||
solaxX1.dc2_power = Energy.current[0] = Energy.voltage[0] = Energy.frequency[0] = Energy.active_power[0] = 0;
|
||||
solaxX1.status = 4; // off(line)
|
||||
} else {
|
||||
if (protocolStatus.queryOfflineSend) {
|
||||
protocolStatus.status = 0b00001000; // queryOffline
|
||||
|
@ -380,7 +387,8 @@ void solaxX1250MSecond(void) // Every 250 milliseconds
|
|||
void solaxX1SnsInit(void)
|
||||
{
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("SX1: Solax X1 Inverter Init"));
|
||||
DEBUG_SENSOR_LOG(PSTR("SX1: RX pin: %d, TX pin: %d"), Pin(GPIO_SOLAXX1_RX), Pin(GPIO_SOLAXX1_TX));
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("SX1: RX-pin: %d, TX-pin: %d, RTS-pin: %d"), Pin(GPIO_SOLAXX1_RX), Pin(GPIO_SOLAXX1_TX), Pin(GPIO_SOLAXX1_RTS));
|
||||
// DEBUG_SENSOR_LOG(PSTR("SX1: RX pin: %d, TX pin: %d"), Pin(GPIO_SOLAXX1_RX), Pin(GPIO_SOLAXX1_TX));
|
||||
protocolStatus.status = 0b00100000; // hasAddress
|
||||
|
||||
solaxX1Serial = new TasmotaSerial(Pin(GPIO_SOLAXX1_RX), Pin(GPIO_SOLAXX1_TX), 1);
|
||||
|
@ -389,6 +397,9 @@ void solaxX1SnsInit(void)
|
|||
} else {
|
||||
TasmotaGlobal.energy_driver = ENERGY_NONE;
|
||||
}
|
||||
if (PinUsed(GPIO_SOLAXX1_RTS)) {
|
||||
pinMode(Pin(GPIO_SOLAXX1_RTS), OUTPUT);
|
||||
}
|
||||
}
|
||||
|
||||
void solaxX1DrvInit(void)
|
||||
|
|
Loading…
Reference in New Issue