mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-06 03:50:13 +02:00
update handle_inverter() to update_values(), to better reflect its function
This commit is contained in:
parent
9e663fa166
commit
c6e09c8610
1 changed files with 7 additions and 7 deletions
|
@ -26,10 +26,10 @@ static ACAN2515_Buffer16 gBuffer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Interval settings
|
//Interval settings
|
||||||
int intervalInverterTask = 4800; //Interval at which to refresh modbus registers / inverter values
|
int intervalUpdateValues = 4800; //Interval at which to refresh modbus registers / inverter values
|
||||||
const int interval10 = 10; //Interval for 10ms tasks
|
const int interval10 = 10; //Interval for 10ms tasks
|
||||||
unsigned long previousMillis10ms = 50;
|
unsigned long previousMillis10ms = 50;
|
||||||
unsigned long previousMillisInverter = 0;
|
unsigned long previousMillisUpdateVal = 0;
|
||||||
|
|
||||||
//ModbusRTU parameters
|
//ModbusRTU parameters
|
||||||
#if defined(BYD_MODBUS)
|
#if defined(BYD_MODBUS)
|
||||||
|
@ -199,7 +199,7 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
#ifdef SOLAX_CAN
|
#ifdef SOLAX_CAN
|
||||||
inverterAllowsContactorClosing = 0; //The inverter needs to allow first on this protocol
|
inverterAllowsContactorClosing = 0; //The inverter needs to allow first on this protocol
|
||||||
intervalInverterTask = 800; //This protocol also requires the values to be updated faster
|
intervalUpdateValues = 800; //This protocol also requires the values to be updated faster
|
||||||
Serial.println("SOLAX CAN protocol selected");
|
Serial.println("SOLAX CAN protocol selected");
|
||||||
#endif
|
#endif
|
||||||
//Inform user what battery is used
|
//Inform user what battery is used
|
||||||
|
@ -244,10 +244,10 @@ void loop() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (millis() - previousMillisInverter >= intervalInverterTask) //every 5s
|
if (millis() - previousMillisUpdateVal >= intervalUpdateValues) //every 5s
|
||||||
{
|
{
|
||||||
previousMillisInverter = millis();
|
previousMillisUpdateVal = millis();
|
||||||
handle_inverter(); //Update values heading towards inverter
|
update_values(); // Update values heading towards inverter. Prepare for sending on CAN, or write directly to Modbus.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output
|
// Output
|
||||||
|
@ -509,7 +509,7 @@ void handle_contactors() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void handle_inverter() {
|
void update_values() {
|
||||||
// battery
|
// battery
|
||||||
#ifdef BMW_I3_BATTERY
|
#ifdef BMW_I3_BATTERY
|
||||||
update_values_i3_battery(); //Map the values to the correct registers
|
update_values_i3_battery(); //Map the values to the correct registers
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue