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:
Martin Jaeger
2019-08-16 11:37:25 +02:00
parent e51a6384fb
commit 3f4f52ea18
9 changed files with 88 additions and 71 deletions
+5 -1
View File
@@ -19,6 +19,8 @@
#include "pcb.h"
#include "log.h"
#ifndef CHARGER_TYPE_PWM
#include "half_bridge.h"
#include <time.h> // for time(NULL) function
@@ -181,7 +183,7 @@ void dcdc_control(Dcdc *dcdc, DcBus *hs, DcBus *ls)
}
}
void Dcdcest(Dcdc *dcdc, DcBus *hs, DcBus *ls)
void dcdc_test(Dcdc *dcdc, DcBus *hs, DcBus *ls)
{
if (half_bridge_enabled()) {
if (half_bridge_get_duty_cycle() > 0.5) {
@@ -225,3 +227,5 @@ void dcdc_self_destruction()
//half_bridge_start(0);
// now the fuse should be triggered and we disappear
}
#endif /* CHARGER_TYPE_PWM */