The DC bus type caused issues because current limits could not be defined individually for each
connection to a junction, as described in issue #50.
With this commit, also some structs were converted to C++ classes to improve readibility of the
code and make sure that pointers (e.g. to PowerPort objects) are always assigned during
initialization.
Reason: According to ThingSet spec, a device is a complete physical hardware device like a charge controller.
Within one device, we can have different communication interfaces that use the ThingSet protocol.
- Discharging control separated from charger state machine
- Unit-tests for discharging control added
- DC bus chg/dis_enabled flags removed, control now only based on chge/dis_current_limit values
- _current_max values renamed to _limit to make more clear that values for discharging direction must be negative
- Load output struct now stores pointer to internal and external DC bus objects
- DcBus representing actual screw terminals renamed
- Internal DC bus at DC/DC low voltage side added for correct DC/DC control
- DC/DC struct now stores pointers to HV and LV bus objects. Redundant voltage and current measurement variables removed.
- Unit tests updated
DC/DC control needs further improvements to make use of the changes
The dcdc_control now better controls which mode (boost vs. buck) is being
used when: If configured in Buck mode, boost mode is never used.
The _dcdc_control function now "knows" if it is in boost or buck mode (dcdc_dir)
The no load condition now uses the dcdc transfer power as measure, not the out current
which is not reflecting the "no dcdc load" condition correctly if a load is connected
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).