PWM switch: Bug fixed + some improvements
- Serious bug: Switch did not go below 90% duty cycle (left-over from testing code). Could result in overcharging of battery. - Improvement: Preventing very short on/off times (duty cycles close to 0 or 1) as switching time is quite slow - PWM frequency now configurable via PCB config (and increased from 20 to 25 Hz) - Some unused parameters in PwmSwitch struct removed and variables renamed - Overcurrent setting now via solar_bus
This commit is contained in:
@@ -105,7 +105,11 @@ void uext_process_1s()
|
||||
oled.drawRect(66, 4, 2, 5, 1); // bar 5
|
||||
|
||||
// solar panel data
|
||||
if (half_bridge_enabled() || pwm_switch_enabled()) {
|
||||
#ifdef CHARGER_TYPE_PWM
|
||||
if (pwm_switch_enabled()) {
|
||||
#else
|
||||
if (half_bridge_enabled()) {
|
||||
#endif
|
||||
tmp = - hv_bus.voltage * hv_bus.current;
|
||||
oled.setTextCursor(0, 18);
|
||||
oled.printf("%4.0fW", (abs(tmp) < 1) ? 0 : tmp); // remove negative zeros
|
||||
|
||||
Reference in New Issue
Block a user