Now handles buffer full condition gracefully. Originally a full buffer
would have prevented any further command processing until reboot
Changed buffer types to minimize the number of explicit cast we are
using
These replace the previous C impementation.
- permits any combination of thingset devices being present
- removes essentially all thingset related #ifdefs outside the actual implementation files.
- Code size is reduced. Code duplication eliminated.
The code is not final in its structure, but works with CAN and Serial.
USBSerial does not work on the F072 (L073 not tested) but this was also
the case for the C implementation.
It is required to apply the changes to the platformio.ini otherwise
the code will not compile.
The dcdc power has to use the dcdc current and voltage instead of the
output voltage (which can be low side - buck or high side - boost) and
the dcdc current instead of the out current. See #44 for the discussion
on this issue.
- 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
During tests, the deep discharge counter increased by several 100 counts per day under certain circumstances, most probably because of quite small battery making the voltage toggle between disconnect and reconnect voltage. This commit suggests several improvements.
- Load reconnect voltage increased
- Don't reconnect before waiting at least 1h (lvd_timestamp in load.cpp)
- SOC filter calculation slightly changed to make sure 100% is reached fast enough.
- The DC/DC test function slowly ramps up the duty cycle to 50% to allow defined measurements of gate driver, switch node etc. with an oscilloscope (without disturbance by the MPPT algorithm)
- The dead-time between HS and LS gate on/off is now configurable for each PCB and not fixed to 300 ns for all PCBs anymore.
* Reduced codesize: Switch to newlib-nano
Figured out how to switch to newlib-nano in a simple way.
Reduced build size by about 29k. Applied this to all STM32 builds.
Please test with the STM32L072 hardware, I don't have one of those,
only STM32F072
Also "upgraded" the compiler accepted language standard to gnu c++11 (from gnu++98).
And finally defined that all floating point constants are to be treated
as "floats" and not as double (which is the default). Reduces the number
of implicit double promotions almost to the required minimum.
In some places the double functions are applied to floats which also
causes some unwanted time and code growth. But this is not fixed yet.
* Change travis to try to deploy only on "master" repo
* Fixed typo
gnu++11 was not really enabled, due to copy'n'paste typo.
* Minor fix in documentation
* Make CAN compile again
* Now able to disable uart_serial
* Boots and runs CAN
Requires matching thingset-cpp library
The placement of the ts_can.process_asap/process_1s is a little hack,
but I did want to add even more ifdefs in the main method.
Renaming the functions could do the trick.
BTW, serial and CAN thingset can be run at the same time, no problems.
* Some cleanups in the CAN interface
* log.h: fix signature of log_update_min_max_values
looks like it was changed in log.cpp, but not adjusted in log.h,
somewhen in the past
* adc_dma: only define variables if they are really required
* reduce scope of variables in interface_can.cpp
* `changed` was reassigned a value before the old one was used
* README: reformat flashing troubleshooting section
* README: punctuation fixes
* README: add troubleshooting tip for bad connection between nucleo and MPPT
This way the OLED display does not overwrite useful data since
the stack on the F072RB in mbed is just 1k and the logog is also 1k.
Also fixed minor issue in OLED display code (refactoring not done).
- Battery temperature set to 25 degC if no external sensor connected
- EEPROM selection added to PCB config file
- UEXT power supply enable added to UEXT init functions
Firmware still gets stuck when OLED display is enabled... Error still to be found!
Previously, the DC/DC started at 90% of the solar panel OCV to be closer to the MPP (at around 80% of OCV). This creates stress on the MOSFETs due to high inrush currents. In addtion to that, a high power panel might not be derated fast enough, which caused issues in the 12V/10A charge controller connected to a 280W panel. This commit improves the situation and starts the MPPT slightly below the measured solar voltage with low power.
The PWM charge controllers don't have a fuse and need a reliable load short
circuit protection implemented in the microcontroller. The comparator
monitoring the load current now triggers LPTIM connected to the load
disable pin. This allows to switch off the load with a defined time delay
and glitch filter.
During tests, switching off the load in an ISR triggered by COMP2 did
not lead to reliable delays (especially in case of wake-up from sleep),
hence this alternative solution using LPTIM was implemented.
The load switch functions were moved from hardware.cpp to load.cpp.
- Immediate load cut-off in case of current > 2x rated current (still to be fine-tuned)
- Using built-in comparator of STM32 MCU
- Currently only supported by PWM charge controller PCB, as it doesn't have an internal fuse
- Correct negative sign for incoming solar current
- Current multiplied with PWM duty cycle to get average current
- Min/max calculation moved to log.cpp
- Using PlatformIO's embedded unit testing with native environment
- mbed-dependent .cpp files escaped with #ifndef UNIT_TEST
- First tests for charger module added under test/ directory
- Files for interfaces connected via UEXT are stored in separate uext/ directory
- UEXT init and process function names independent of connected module
- LED function names adjusted to start with leds_
- main.cpp structure simplified