AlexanderTonn / SolarPowerhouse

Solar balkony power plant, which includes control logic for switching between micro inverter and battery depending on the state of charge. The repository containing any drawings and manuals.
Apache License 2.0
0 stars 0 forks source link

[PERFORMANCE] Optimise Relay switching #24

Closed AlexanderTonn closed 9 months ago

AlexanderTonn commented 10 months ago

 :rocket: Please describe your performance changes

Affected Functions

void relayOnMppt() {
  auto ms = secondToMs(uiSett_PVswitchingDelay);
  digitalWrite(K2_INVERTER_AC, LOW);
  delay(ms);
  digitalWrite(K1_INVERTER_DC, LOW);
  delay(ms);
  digitalWrite(K3_MPPT_CHARGER, HIGH);
  byModeActual = BATTERY_MODE;
}
void relayOnInverter() {
  auto ms = secondToMs(uiSett_PVswitchingDelay);
  digitalWrite(K3_MPPT_CHARGER, LOW);
  delay(ms);
  digitalWrite(K1_INVERTER_DC, HIGH);
  delay(ms);
  digitalWrite(K2_INVERTER_AC, HIGH);
  byModeActual = INVERTER_MODE;
}

 :pencil2: Describe the solution you'd like