@@ -63,14 +63,14 @@ void Controller::updateSettings()
63
63
_upHardwareInterface = std::make_unique<TWAI>();
64
64
break ;
65
65
default :
66
- MessageOutput.printf (" [HuaweiCanClass::init ] Unknown hardware "
66
+ MessageOutput.printf (" [Huawei::Controller ] Unknown hardware "
67
67
" interface setting %d\r\n " , config.Huawei .HardwareInterface );
68
68
return ;
69
69
break ;
70
70
}
71
71
72
72
if (!_upHardwareInterface->init ()) {
73
- MessageOutput.println (" [HuaweiCanClass::init ] Error initializing hardware interface" );
73
+ MessageOutput.print (" [Huawei::Controller ] Error initializing hardware interface\r\n " );
74
74
_upHardwareInterface.reset (nullptr );
75
75
return ;
76
76
};
@@ -86,7 +86,7 @@ void Controller::updateSettings()
86
86
_mode = HUAWEI_MODE_AUTO_INT;
87
87
}
88
88
89
- MessageOutput.println (" [HuaweiCanClass::init ] Hardware Interface initialized successfully" );
89
+ MessageOutput.print (" [Huawei::Controller ] Hardware Interface initialized successfully\r\n " );
90
90
}
91
91
92
92
RectifierParameters_t * Controller::get ()
@@ -126,9 +126,12 @@ void Controller::loop()
126
126
127
127
// Print updated data
128
128
if (lastUpdate != _lastUpdateReceivedMillis && verboseLogging) {
129
- MessageOutput.printf (" [HuaweiCanClass::loop] In: %.02fV, %.02fA, %.02fW\n " , _rp.input_voltage , _rp.input_current , _rp.input_power );
130
- MessageOutput.printf (" [HuaweiCanClass::loop] Out: %.02fV, %.02fA of %.02fA, %.02fW\n " , _rp.output_voltage , _rp.output_current , _rp.max_output_current , _rp.output_power );
131
- MessageOutput.printf (" [HuaweiCanClass::loop] Eff : %.01f%%, Temp in: %.01fC, Temp out: %.01fC\n " , _rp.efficiency * 100 , _rp.input_temp , _rp.output_temp );
129
+ MessageOutput.printf (" [Huawei::Controller] In: %.02fV, %.02fA, %.02fW\r\n " ,
130
+ _rp.input_voltage , _rp.input_current , _rp.input_power );
131
+ MessageOutput.printf (" [Huawei::Controller] Out: %.02fV, %.02fA of %.02fA, %.02fW\r\n " ,
132
+ _rp.output_voltage , _rp.output_current , _rp.max_output_current , _rp.output_power );
133
+ MessageOutput.printf (" [Huawei::Controller] Eff: %.01f%%, Temp in: %.01f°C, Temp out: %.01f°C\r\n " ,
134
+ _rp.efficiency * 100 , _rp.input_temp , _rp.output_temp );
132
135
}
133
136
134
137
// Internal PSU power pin (slot detect) control
@@ -147,7 +150,8 @@ void Controller::loop()
147
150
148
151
// Set voltage limit in periodic intervals if we're in auto mode or if emergency battery charge is requested.
149
152
if ( _nextAutoModePeriodicIntMillis < millis ()) {
150
- MessageOutput.printf (" [HuaweiCanClass::loop] Periodically setting voltage limit: %f \r\n " , config.Huawei .Auto_Power_Voltage_Limit );
153
+ MessageOutput.printf (" [Huawei::Controller] Periodically setting "
154
+ " voltage limit: %f \r\n " , config.Huawei .Auto_Power_Voltage_Limit );
151
155
_setParameter (config.Huawei .Auto_Power_Voltage_Limit , Setting::OnlineVoltage);
152
156
_nextAutoModePeriodicIntMillis = millis () + 60000 ;
153
157
}
@@ -163,7 +167,8 @@ void Controller::loop()
163
167
// Set output current
164
168
float efficiency = (_rp.efficiency > 0.5 ? _rp.efficiency : 1.0 );
165
169
float outputCurrent = efficiency * (config.Huawei .Auto_Power_Upper_Power_Limit / _rp.output_voltage );
166
- MessageOutput.printf (" [HuaweiCanClass::loop] Emergency Charge Output current %f \r\n " , outputCurrent);
170
+ MessageOutput.printf (" [Huawei::Controller] Emergency Charge Output "
171
+ " current %.02f \r\n " , outputCurrent);
167
172
_setParameter (outputCurrent, Setting::OnlineCurrent);
168
173
return ;
169
174
}
@@ -197,7 +202,7 @@ void Controller::loop()
197
202
_setParameter (0.0 , Setting::OnlineCurrent);
198
203
// Don't run auto mode for a second now. Otherwise we may send too much over the CAN bus
199
204
_autoModeBlockedTillMillis = millis () + 1000 ;
200
- MessageOutput.printf (" [HuaweiCanClass::loop ] Inverter is active, disable\r\n " );
205
+ MessageOutput.printf (" [Huawei::Controller ] Inverter is active, disable PSU \r\n " );
201
206
return ;
202
207
}
203
208
@@ -216,7 +221,8 @@ void Controller::loop()
216
221
newPowerLimit += _rp.output_power + config.Huawei .Auto_Power_Target_Power_Consumption / efficiency;
217
222
218
223
if (verboseLogging){
219
- MessageOutput.printf (" [HuaweiCanClass::loop] newPowerLimit: %f, output_power: %f \r\n " , newPowerLimit, _rp.output_power );
224
+ MessageOutput.printf (" [Huawei::Controller] newPowerLimit: %.0f, "
225
+ " output_power: %.01f\r\n " , newPowerLimit, _rp.output_power );
220
226
}
221
227
222
228
// Check whether the battery SoC limit setting is enabled
@@ -226,7 +232,7 @@ void Controller::loop()
226
232
if (_batterySoC >= config.Huawei .Auto_Power_Stop_BatterySoC_Threshold ) {
227
233
newPowerLimit = 0 ;
228
234
if (verboseLogging) {
229
- MessageOutput.printf (" [HuaweiCanClass::loop ] Current battery SoC %i reached "
235
+ MessageOutput.printf (" [Huawei::Controller ] Current battery SoC %i reached "
230
236
" stop threshold %i, set newPowerLimit to %f \r\n " , _batterySoC,
231
237
config.Huawei .Auto_Power_Stop_BatterySoC_Threshold , newPowerLimit);
232
238
}
@@ -239,7 +245,9 @@ void Controller::loop()
239
245
// and if the PSU should be turned off. Also we use a simple counter mechanism here to be able
240
246
// to ramp up from zero output power when starting up
241
247
if (_rp.output_power < config.Huawei .Auto_Power_Lower_Power_Limit ) {
242
- MessageOutput.printf (" [HuaweiCanClass::loop] Power and voltage limit reached. Disabling automatic power control .... \r\n " );
248
+ MessageOutput.print (" [Huawei::Controller] Power and "
249
+ " voltage limit reached. Disabling automatic power "
250
+ " control.\r\n " );
243
251
_autoPowerEnabledCounter--;
244
252
if (_autoPowerEnabledCounter == 0 ) {
245
253
_autoPowerEnabled = false ;
@@ -264,7 +272,11 @@ void Controller::loop()
264
272
outputCurrent= outputCurrent > 0 ? outputCurrent : 0 ;
265
273
266
274
if (verboseLogging) {
267
- MessageOutput.printf (" [HuaweiCanClass::loop] Setting output current to %.2fA. This is the lower value of calculated %.2fA and BMS permissable %.2fA currents\r\n " , outputCurrent, calculatedCurrent, permissableCurrent);
275
+ MessageOutput.printf (" [Huawei::Controller] Setting output "
276
+ " current to %.2fA. This is the lower value of "
277
+ " calculated %.2fA and BMS permissable %.2fA "
278
+ " currents\r\n " , outputCurrent, calculatedCurrent,
279
+ permissableCurrent);
268
280
}
269
281
_autoPowerEnabled = true ;
270
282
_setParameter (outputCurrent, Setting::OnlineCurrent);
@@ -294,7 +306,7 @@ void Controller::_setParameter(float val, HardwareInterface::Setting setting)
294
306
if (!_upHardwareInterface) { return ; }
295
307
296
308
if (val < 0 ) {
297
- MessageOutput.printf (" [HuaweiCanClass::_setParameter ] Error: Tried to set "
309
+ MessageOutput.printf (" [Huawei::Controller ] Error: Tried to set "
298
310
" voltage/current to negative value %.2f\r\n " , val);
299
311
return ;
300
312
}
@@ -329,7 +341,9 @@ void Controller::setMode(uint8_t mode) {
329
341
auto const & config = Configuration.get ();
330
342
331
343
if (mode == HUAWEI_MODE_AUTO_INT && !config.Huawei .Auto_Power_Enabled ) {
332
- MessageOutput.println (" [HuaweiCanClass::setMode] WARNING: Trying to setmode to internal automatic power control without being enabled in the UI. Ignoring command" );
344
+ MessageOutput.println (" [Huawei::Controller] WARNING: Trying to set "
345
+ " mode to internal automatic power control without being enabled "
346
+ " in the UI. Ignoring command." );
333
347
return ;
334
348
}
335
349
0 commit comments