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
+3 -2
View File
@@ -25,9 +25,10 @@
#define CHARGER_TYPE_PWM 1 // PWM charge controller instead of MPPT
#define PWM_TIM 3 // use TIM3 timer
#define PWM_FREQUENCY 25 // Hz
#define DCDC_CURRENT_MAX 20 // PCB maximum DCDC output current
#define LOAD_CURRENT_MAX 20 // PCB maximum load switch current
#define PWM_CURRENT_MAX 20 // PCB maximum PWM switch (solar) current
#define LOAD_CURRENT_MAX 20 // PCB maximum load switch current
#define LOW_SIDE_VOLTAGE_MAX 30 // Maximum voltage at battery port (V)
#define HIGH_SIDE_VOLTAGE_MAX 55 // Maximum voltage at PV input port (V)