@@ -39,8 +39,8 @@ int last_state = OPENEVSE_STATE_INVALID;
3939uint32_t lastUpdate = 0 ;
4040
4141
42- double avalible_current = 0 ;
43- double smoothed_avalible_current = 0 ;
42+ double available_current = 0 ;
43+ double smoothed_available_current = 0 ;
4444
4545time_t min_charge_end = 0 ;
4646
@@ -76,8 +76,8 @@ void divertmode_update(byte newmode)
7676
7777 case DIVERT_MODE_ECO:
7878 charge_rate = 0 ;
79- avalible_current = 0 ;
80- smoothed_avalible_current = 0 ;
79+ available_current = 0 ;
80+ smoothed_available_current = 0 ;
8181 min_charge_end = 0 ;
8282
8383 // Read the current charge current, assume this is the max set by the user
@@ -87,7 +87,7 @@ void divertmode_update(byte newmode)
8787 }
8888 if (OPENEVSE_STATE_SLEEPING != state)
8989 {
90- if (0 == rapiSender.sendCmdSync (F (" $FS" )))
90+ if (0 == rapiSender.sendCmdSync (F (" $FS" )))
9191 {
9292 DBUGLN (F (" Divert activated, entered sleep mode" ));
9393 divert_active = false ;
@@ -164,31 +164,31 @@ void divert_update_state()
164164 // If excess power
165165 double reserve = GRID_IE_RESERVE_POWER / voltage;
166166 DBUGVAR (reserve);
167- avalible_current = (-Igrid_ie - reserve);
167+ available_current = (-Igrid_ie - reserve);
168168 }
169169 else
170170 {
171171 // no excess, so use the min charge
172- avalible_current = 0 ;
172+ available_current = 0 ;
173173 }
174174 }
175175 else if (mqtt_solar!=" " )
176176 {
177177 // if grid feed is not available: charge rate = solar generation
178178 DBUGVAR (voltage);
179- avalible_current = (double )solar / voltage;
179+ available_current = (double )solar / voltage;
180180 }
181181
182- if (avalible_current < 0 ) {
183- avalible_current = 0 ;
182+ if (available_current < 0 ) {
183+ available_current = 0 ;
184184 }
185- DBUGVAR (avalible_current );
185+ DBUGVAR (available_current );
186186
187- double scale = avalible_current > smoothed_avalible_current ? divert_attack_smoothing_factor : divert_decay_smoothing_factor;
188- smoothed_avalible_current = (avalible_current * scale) + (smoothed_avalible_current * (1 - scale));
189- DBUGVAR (smoothed_avalible_current );
187+ double scale = available_current > smoothed_available_current ? divert_attack_smoothing_factor : divert_decay_smoothing_factor;
188+ smoothed_available_current = (available_current * scale) + (smoothed_available_current * (1 - scale));
189+ DBUGVAR (smoothed_available_current );
190190
191- charge_rate = (int )floor (avalible_current );
191+ charge_rate = (int )floor (available_current );
192192
193193 if (OPENEVSE_STATE_SLEEPING != state) {
194194 // If we are not sleeping, make sure we are the minimum current
@@ -197,7 +197,7 @@ void divert_update_state()
197197
198198 DBUGVAR (charge_rate);
199199
200- if (smoothed_avalible_current >= min_charge_current)
200+ if (smoothed_available_current >= min_charge_current)
201201 {
202202 // Cap the charge rate at the configured maximum
203203 charge_rate = min (charge_rate, static_cast <int >(max_charge_current));
@@ -279,8 +279,8 @@ void divert_update_state()
279279
280280 event[" charge_rate" ] = charge_rate;
281281 event[" voltage" ] = voltage;
282- event[" avalible_current " ] = avalible_current ;
283- event[" smoothed_avalible_current " ] = smoothed_avalible_current ;
282+ event[" available_current " ] = available_current ;
283+ event[" smoothed_available_current " ] = smoothed_available_current ;
284284 } // end ecomode
285285
286286 event_send (event);
0 commit comments