Skip to content

Commit fa50ca0

Browse files
authored
Merge pull request #93 from Stef-Sijben/fixTypo
Fix typo avalible --> available
2 parents f6c8c83 + f5691b1 commit fa50ca0

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

divert_sim/divert_sim.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ time_t simulated_time = 0;
3333

3434
bool kw = false;
3535

36-
extern double smoothed_avalible_current;
36+
extern double smoothed_available_current;
3737
extern double divert_attack_smoothing_factor;
3838
extern double divert_decay_smoothing_factor;
3939

@@ -143,7 +143,7 @@ int main(int argc, char** argv)
143143
parser.delimiter(sep.c_str()[0]);
144144
int row_number = 0;
145145

146-
std::cout << "Date,Solar,Grid IE,Pilot,Charge Power,Min Charge Power,State,Smoothed Avalible" << std::endl;
146+
std::cout << "Date,Solar,Grid IE,Pilot,Charge Power,Min Charge Power,State,Smoothed Available" << std::endl;
147147
for (auto& row : parser)
148148
{
149149
try
@@ -179,7 +179,7 @@ int main(int argc, char** argv)
179179
int ev_watt = ev_pilot * voltage;
180180
int min_ev_watt = 6 * voltage;
181181

182-
double smoothed = smoothed_avalible_current * voltage;
182+
double smoothed = smoothed_available_current * voltage;
183183

184184
std::cout << buffer << "," << solar << "," << grid_ie << "," << ev_pilot << "," << ev_watt << "," << min_ev_watt << "," << state << "," << smoothed << std::endl;
185185
}

gui

src/divert.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ int last_state = OPENEVSE_STATE_INVALID;
3939
uint32_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

4545
time_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

Comments
 (0)