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
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.
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.
In some cases the old code would cause a +1/-1 step not actually changing the PWM due to rounding issues.
New code directly changes the integer value and thus avoids this issue.
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
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.
* 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
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).