- Made Adafruit GFX library independent of mbed Stream class
- Major cleanup/rewrite of SSD1306 specific class
- Dynamically allocated std::vector display buffer replaced with statically
allocated std::array (leads to more calculated RAM usage only because
previous heap usage is not considered in memory summary)
- Commands for brightness control and to prevent shifted display now
integrated in SSD1306 class
Rationale: Many editors (inclding mine) are set to automatically remove
trailing whitespaces. Updating files with trailing spaces creates distracting
additional lines in diffs.
- Alerts now set to +-20% of actual measured voltage
- Hysteresis for load overvoltage reconnect setpoint made configurable
- Added check for PWM switch MOSFET driver undervoltage
- State machine and control merged to one function
- Load states marked as deprecated, global error flags used instead
- Reduced duplicated code and made load control function easier to read
The bat config calculation did calculate the absolute max voltage
too high, it was doing an unnecessary multiplication.
This triggered an issue in the voltage limit set code, which did not
handle the overflow of the 16bit limit value properly.
Both are fixed now. We limit the limit value to what the ADC is able
to deliver, so that we detect overvoltage for sure, even if the setting
is out of ADC range.
We should use src_voltage_stop as limit,
since the input voltage start limit is basically an OC voltage
where as the stop voltage is a voltage to be measured under load.
- replaced the lengthy adc value formulas with respective functions
to ease reading
- removed unecessary casts for alert callbacks
- added static to the internal global variables in order to hide them from the
other compilation units
- OLED brightness can be set to extend life
- OLED display correctly initialized at MCU restart even without power off
Sometimes the OLED display displays all content shifted if the MCU is
reset without cutting the power to the display (i.e. without display reset).
- SOC is display in battery symbol showing 0 to 5 bars
- Internal temperature is displayed if no external sensor is detected (t)
- PWM value displays as "OFF" if the PWM/halfbridge is not active
Previously, the alert was sometimes erroneously triggered in PWM charger
absorption phase (constant voltage, PWM switching). Now the overvoltage
alert is inhibited during turn-on in each PWM cycle by an interrupt.
This issue happened because the HAL ADC configuration data structure
is allocated on the stack (which by default is not initialized,
i.e. contains potentially non-zero data). As most of this structure was
explicitly initialized only sometimes the OversampleMode setting was
not 0, in this case the ADC had no left data alignment, i.e. delivered
too low values. If it happens, the system sees very weird temperature
and voltage/power values.
- During overvoltage alerts, only power sources (PWM switch and DC/DC are
switched off), undervoltage only switches load off
- Alert inhibit added to prevent switching off during PWM switch startup
Check for overvoltage/undervoltage conditions after each ADC reading cycle and
trigger alert (stopping DC/DC, PWM switch and load output) if limits exceeded.
The change permits use of multiple UExt objects at the same time,
given that these use different pins.
The current UExt code is safe to be used in combination
(OLED display and ESP32 wifi).
Future extension may require some checks to be put in place to
ensure correct configuration.
Could be achieved using preprocessor macros easily.
Uses same objectification concept we used for the ThingSet devices.
Could be merged into one if desired.
In addition to the normal error flags we now have
ERR_ANY_ERROR which may be used to clear all errors
at once or to use in has_error to see if there is any error flag set.
Rationale: Logging is used for historic data, but error flags are instantaneous data. Device status
is more generic and now contains also the internal temperature measurement.
- MCU temperature was renamed to internal_temperature
- NTC at board edge senses temperatures far above battery / ambient temperature at high loads and is now ignored
- Battery temperature always assumed 25ÂC unless external sensor is detected
- Switched back to older mbed version, as update broke comparator function
- Added voltage dip detection to disconnect load if charge controller is connected to small
battery or with bad wires and short circuit detection doesn't trigger
- Added more error flags to diagnose reasons for load disconnect