439 Commits
Author SHA1 Message Date
Martin Jäger 5196694e42 Inclusive language: Rename master to main branch 2021-04-14 12:32:14 +02:00
Martin Jäger 613e454fed Clean up prj.conf and improve documentation 2021-04-14 12:23:07 +02:00
Martin Jäger 1943533360 Use UEXT serial for ThingSet by default
Rationale: ESP32 modules can be used as gateways without firmware change.
2021-04-14 11:41:52 +02:00
Martin Jäger 8d8a8f06ad Improve Kconfig and docs for battery type setup 2021-04-14 11:41:50 +02:00
Martin Jäger fac325d423 ThingSet: Move info/Timestamp_s to output/Uptime_s
This makes clear that the timestamp is not the actual time, but the
seconds since the device started.

The timestamp is also not stored in NVM anymore, as the DayCount provides
information about the operating time of the device already. This way
it can be found out if there was a reset of the device based on its uptime.
2021-04-14 11:20:20 +02:00
Martin Jäger cc0bdc1004 Print firmware and hardware version during startup 2021-04-14 11:19:31 +02:00
Martin Jäger daff69550f MPPT 1210 HUS: Match LED assignment with manual 2021-04-14 11:19:31 +02:00
Martin Jäger ede29544d2 CI: Add PlatformIO native manually to fix unit tests 2021-04-14 11:19:31 +02:00
Martin Jäger bc61a29bed Increase HS voltage of MPPT 2420 HC to 90V 2021-04-14 11:19:31 +02:00
Martin Jäger b4483129c2 Configure ThingSet pub messages via Kconfig and enable by default 2021-04-08 09:39:38 +02:00
Martin Jäger faf3bde214 Improve MPPT behavior for STM32G4 series
- Increase PWM step size to see differences between each controller run
- Take ADC2 measurements (current sensors) synchronous to voltages
  (previous approach with high-rate current measurement once per PWM
  cycle only makes sense for cycle-by-cylce control, not for slow MPPT)
2021-03-28 17:37:55 +02:00
Martin Jäger 94dc0d9a3f DAQ: Call update after initial calibration
Otherwise the current measurement will show wrong readings in ThingSet
messages read before control thread started.
2021-03-27 18:26:55 +01:00
Martin Jäger b2707067ac NVS data storage: Improve logging 2021-03-17 13:19:19 +01:00
Martin Jäger d2b4eb7f7e DCDC: Make low power shut off less sensitive
The controllers with fast ADC sampling speed were sometimes switched off
immediately after turn-on. Switching off at negative power flow is only an
additional safety measure. Normally the controller should switch off
reliably because of power_good_timestamp already.
2021-03-17 13:00:00 +01:00
Martin Jäger 3f11266838 Disable pull-down on PB4 and PB6 for STM32G4 MCUs
This pull-down caused issues with the latching power-good function in a
board which required PB6 to be configured as an input.
2021-03-16 17:51:24 +01:00
Martin Jäger 3b68bc1bcc Use STM32 LL API to enable clocks (e.g. for CRC)
Reason: We need to wait until the clock enable register is actually set before
we can consider the clock running. This caused an issue with the CRC
peripheral, which sometimes did not work correctly (always returned 0) right
after startup.

This commit switches to LL API, which includes a delay. Updating all occurences
of direct clock enabling via registers and not only the CRC peripheral.
2021-03-16 17:51:15 +01:00
Martin Jäger 5e02ab2292 Data storage: Add NVS backend to use flash instead of EEPROM 2021-03-12 18:40:22 +01:00
Martin Jäger 8c7a18662e Data storage: Use Zephyr logging system 2021-03-12 18:40:22 +01:00
Martin Jäger a06f14b63c Rename eeprom files to more generic data_storage
This is a preparation for futur non-volatile storage in flash memory.
2021-03-12 18:40:22 +01:00
Martin Jäger 483e09d1a2 Use generic Copyright notice in all files 2021-03-12 18:40:22 +01:00
Martin Jäger c87e5f974a Add MPPT 2420 HC v0.2 board 2021-03-12 18:40:21 +01:00
Martin Jäger 2bbba0ba13 Upgrade PlatformIO to ststm32 v12.0.0 (includes Zephyr v2.5) 2021-03-11 16:42:56 +01:00
Martin Jäger cfeec975c1 Include git SHA into firmware version
Removing separate CommitHash data node because it's not needed anymore.
2021-03-11 16:42:43 +01:00
Martin Jäger 98c1daa865 Enable CONFIG_I2C only if needed (e.g. for OLED or EEPROM) 2021-02-28 11:04:42 +01:00
Martin Jäger f8d7b25648 DCDC: Update HV output switch handling 2021-02-24 16:45:01 +01:00
Daniel Fanache 01ca3b4f15 Fix lv_terminal filtered current and add PWM filtered current.
The lv_terminal filtered current was in fact summing voltages.

Added a separate PWM switch low-pass filter current with more
responsive time constant.
2021-02-24 16:45:01 +01:00
Martin Jäger f6aeaa79db Fix hard faults in EEPROM CRC calculation
The hardware CRC calculation fails hard if a non-aligned memory pointer
is passed to it. This was leading to random issues when changing
unrelated parts in the firmware so that the compiler shuffled memory
locations.

Telling GCC that it should word-align the buffer fixes the issue.

Also renaming _lock to eeprom_buf_lock.
2021-02-05 20:58:16 +01:00
Martin Jäger 6aa015a140 Add basic HRTIM implementation for half_bridge 2021-02-05 18:12:31 +01:00
Martin Jäger fc71934010 Add Nucleo G474RE board for testing purposes 2021-02-05 17:51:10 +01:00
Martin Jäger c151213325 Compile EEPROM code only if enabled via Kconfig 2021-02-05 17:41:52 +01:00
Jordan Silverman a9b0a278ad EEPROM buffer mutex
Added a mutex locking system so that the EEPROM buffer cannot be
used by multiple functions at the same time.
2021-02-05 17:18:49 +01:00
Jordan Silverman a5c1d46d63 Consolidate eeprom buffers
We now use 1 statically allocated buffer for both eeprom_store and
eeprom_restore
2021-02-05 17:18:47 +01:00
Martin Jäger 35b390ff24 Battery voltage & current filtering to improve charging algorithm
For PWM charge controllers, the topping stage was sometimes very short
and the battery did not get fully charged.

This commit adds a voltage_filtered and current_filtered member variable
to DcBus and PowerPort classes which can hold measurements more heavily
filtered (initial time constant setting: 10 seconds). This should fix
above issues with the charging algorithm.
2021-02-04 17:28:52 +01:00
Martin Jäger 269ce762a0 Introduce new Zephyr board revisioning feature
This file layout allows to specify the revision using <board-name>@<revision>
during west build calls.
2021-02-04 17:28:52 +01:00
Martin Jäger ed29e54d20 Add reset for J-Link runner of STM32L0/F0 based boards
Otherwise they don't always wake up after flashing.
2021-02-04 17:28:52 +01:00
Martin Jäger bdf405fb7b Load: Clear ERR_LOAD_BUS_SRC_CURRENT if current is available again
Previously, the error was never cleared after it was set, which is obviously
a bad idea.
2021-02-04 17:28:52 +01:00
Martin Jäger 1b1ed838eb Fix log minimal mode Kconfig for Zephyr 2.5 2021-02-04 17:28:52 +01:00
Martin Jäger 2de110b0b7 Half bridge: New dts binding to fix pinmux
The previous approach to define the pinmux in the timer nodes didn't work
because the timers don't have a pinctrl-0 property. This commit adds a new
half-bridge binding similar to upstream Zephyr pwm binding, which is a child
node of the used timer.

It makes sense to define PWM frequency and dead-time also in this node, so
the dcdc devicetree binding is redundant and therefore removed.
2021-02-04 17:28:52 +01:00
Martin Jäger 4eaf89154a Use BOARD_HAS_* macro to identify key hardware features
These macros replace the direct use of DT_ macros in many locations and make
the code more readable.
2021-02-04 17:28:52 +01:00
Martin Jäger 830315cda0 Use new ThingSet macros for CAN and ISO-TP fixed addressing 2021-02-04 17:28:52 +01:00
Martin Jäger 24742fefcb Fix CAN ISO-TP binding and CAN IDs
For the recv_ctx, the rx and tx addresses were swapped. In addition to that,
the binding has to be released before sending.
2021-02-04 17:28:52 +01:00
Martin Jäger fec60aacbb Enable CAN for MCUs with CAN-FD controller 2021-02-04 17:28:52 +01:00
Martin Jäger a352d6b98c Replace software watchdog with Zephyr task_wdt subsystem 2021-02-04 17:28:52 +01:00
Martin Jäger 941545ea7e Move to pinmux based on devicetree 2021-02-04 17:28:51 +01:00
Martin Jäger 0f109297e4 Use generic LL headers 2021-01-14 19:16:06 +01:00
Martin Jäger e63a2db9e5 Update west.yml and platformi.ini to track Zephyr v2.5
The v2.5-branch is based on upstream master until Zephyr v2.5 is released.

hal_stm32 needs to be overwritten with forked version to support new pinctrl
introduced in Zephyr 2.5.

Also fixing some CAN issues because of API changes to make it compile.
2021-01-14 19:11:59 +01:00
Jordan Silverman bcf54f6698 Add latching pgood function to USB power output 2021-01-14 19:07:19 +01:00
Martin Jäger 3653b88d25 Remove ADC/DAC dts nodes now present in upstream Zephyr 2020-12-15 10:47:29 +01:00
Martin Jäger e5b42ace72 Load: Use Zephyr PWM driver for charge pump 2020-12-15 10:47:14 +01:00
Daniel Fanache 9ba540ec8c Configurable log levels for all the modules using Zephyr's logging.
This allows us to enable e.g debug output for the CAN module with
CONFIG_CAN_LOG_LEVEL=4 without enabling the global
CONFIG_LOG_DEFAULT_LEVEL=4 and being swamped with debug output from
all of Zephyr's subsytems.
2020-12-13 11:06:02 +01:00
Martin Jäger 755e555611 Fix DC/DC debug print variables 2020-12-13 11:05:52 +01:00
Martin Jäger a2ab1ebd45 PWM switch: Improve overvoltage protection
In situations with full battery and sufficient solar panel power, the
battery could reach a high voltage directly after start of the PWM switch
and the control algorithm was not fast enough to limit the voltage (it
takes up to 18s to reach 5% duty cycle after starting at 95%).

This commit increases the step size in the direction of reduced power
and introduces an overvoltage flag that results in restart with 5% duty
cycle if the previous stop was caused by an overvoltage event.
2020-12-13 11:05:05 +01:00
Martin Jäger 4f4bdc70ae PWM switch: Clean up comments and add F suffixes 2020-12-13 11:04:56 +01:00
Martin Jäger 76ee3dc28f Doxygen: Disable preprocessing to include all classes 2020-12-11 22:19:23 +01:00
Martin Jäger 583924a9b9 Fix corrupted %f printf because of disabled heap
newlib requires malloc if printf is used with %f. Since PR 28486, the heap
space in RAM is only reserved if explicitly used by the application
(independent of the value of CONFIG_HEAP_MEM_POOL_SIZE) in order to free
some stack memory. As printf calls malloc internally, this commit forces
Zephyr to build with heap support enabled.
2020-11-18 21:05:05 +01:00
Martin Jäger e5e27c10bc Add MPPT 2420 HC link to Readme 2020-11-18 21:05:05 +01:00
Martin Jäger cb4d4ea1d9 LEDs: Use GPIO flags from dts properly
The flags were always assumed to be ACTIVE_HIGH, which is now fixed.
2020-11-18 21:05:04 +01:00
Martin Jäger 47c1614ed0 Add MPPT 2420 HC board 2020-11-10 16:50:52 +01:00
Martin Jäger 5c3e227928 Add west.yml to use native Zephyr build system properly 2020-11-09 20:08:36 +01:00
Martin Jäger 3d9c4589cd Upgrade to Zephyr 2.4
- Make all struct device * constant
- Add additional argument to PWM nodes in devicetree
- Track customized LibreSolar/zephyr branch in platformio
- Update OLED submodule
2020-11-09 20:07:49 +01:00
Martin Jäger 62d28d9e5e Remove unneeded helper.cpp 2020-11-05 20:42:46 +01:00
Martin Jäger b63cdaa06d DC/DC: Use high/low DcBus instead of PowerPort for control
This makes more sense because the DC/DC converter actually connects two
DcBuses and does not need separate PowerPorts. Also makes the code look
more clean as variable access like dcdc.hvs->bus->voltage is avoided.

The DcBus pointers in the Dcdc are now called hvb and lvb for high-
voltage side bus and low-voltage side bus.
2020-11-05 20:42:34 +01:00
Martin Jäger 0756341b29 Rename src/sink_voltage_bound to _intercept
These variables define the voltage at zero current, which is the y axis
intercept of the droop curve (voltage vs. current).
As they do not always specifiy minimum or maximum boundary depending on
the sign of the droop resistance, intercept is a more suitable name.
2020-11-05 20:42:00 +01:00
Martin Jäger 7cd89bc04a PWM switch: Fix start voltage check
Previous statement didn't consider the series multiplier in case of 24V
battery.
2020-11-05 20:38:55 +01:00
Jordan Silverman 1a29aa1a6e Load NVM settings after data_nodes_init 2020-11-05 20:38:36 +01:00
Martin Jäger 1e64c253ac DAQ: Fix LV terminal current for DC/DC + PWM
Current calculation was wrong if both DC/DC and PWM ports are available
on the same device.
2020-11-05 20:38:03 +01:00
Martin Jäger 1e71ed043e DC/DC: Fix ls_voltage_max setting 2020-11-05 20:37:16 +01:00
Martin Jäger 42759947f8 DAQ: Add high-side overvoltage alert limit
Also rename the functions which set the alert limits to set_xx_limit
instead of set_xx_alert.
2020-11-05 20:37:03 +01:00
Martin Jäger c6709f8f00 Rename (Dcdc|PwmSwitch)::emergency_stop to stop
The stop functions can be used in a generic way, not only in an emergency
situation. The name was misleading.
2020-11-05 20:36:51 +01:00
Jordan Silverman 75e2969274 Update thingset lib commit 2020-11-05 20:36:51 +01:00
Martin Jäger 213e2e30b6 Increase control thread priority to -1
Set to lowest cooperative priority so that it cannot be interrupted by main
or other threads (only by ISRs).
2020-11-05 20:34:59 +01:00
Martin Jäger b40a419e3e Optimize timing of 1s loop in main.cpp
Previously, the interval was not exactly 1s, which could have a negative
impact on energy calculations.

This commit also moves the 1s interval tasks from control loop to the main
loop to avoid duplicated loops running at 1s interval.
2020-11-05 20:30:08 +01:00
Martin Jäger 62338711bc Fix ADC2 triggering for STM32G4 MCUs
When switching to edge-aligned PWM, the ADC measurement was accidentally
triggered at the beginning of the switching cycle.
Fixing this using TIM1 OC6, triggering at falling edge.
2020-10-14 10:04:05 +02:00
Martin Jäger db9c9c5b1c Rename DC/DC operation mode and control names
New control states allow to specify the reason for derating more detailed,
also considering the input side.

The operation mode is now also used as a return value for
check_start_conditions function to get rid of magic numbers.
2020-10-14 10:03:34 +02:00
Martin Jäger c38f1c8348 Cleanup of DC/DC control function
The check for high-side MOSFET shorts and startup inhibit are moved to
separate functions to keep the general control function more clean.

Also declared check_start_conditions weak to allow custom overriding.
2020-10-14 09:53:39 +02:00
Martin Jäger a65bcfe3c2 DAQ: Fix VREF calculation for 16-bit left-aligned readings
Calculation was still for previous 12-bit right-aligned ADC readings
and resulted in wrong calculation of MCU internal temperature.
2020-10-14 09:52:20 +02:00
Martin Jäger 06499a2409 PWM solar input: Fix voltage calculation offset in dts
This offset had to be left-shifted by 4 since the DAQ calculations switched
to 16-bit resolution.
2020-10-14 09:51:52 +02:00
Jordan Silverman bb39ff6236 Update data nodes 2020-10-14 09:48:20 +02:00
Jordan Silverman 9d09f1431b Add grid energy counters 2020-10-14 09:45:45 +02:00
Martin Jäger ef9c8571cc ADC filter time constant configurable per channel
Add a filter-const prop to the adc_inputs devicetree binding and use it instead
of the global ADC_FILTER_CONST in daq.cpp.
2020-09-21 13:29:31 +02:00
Martin Jäger 4008a09f3b ADC: Use 16-bit raw values for calculations
Using 16-bit for calculation allows to increase resolution by oversampling.
The ADC was already configured to use left-aligned 12-bit readings, which can
be treated the same as 16-bit native readings.
2020-09-21 13:29:31 +02:00
Martin Jäger 3bb4a86b5c DAQ: Calculate current offset using raw reading
Makes the calculation more efficient compared to floating point math
2020-09-21 13:29:31 +02:00
Martin Jäger 16c629ed86 DC/DC: Use edge-aligned PWM mode with TIM1
This increases the resolution of the PWM duty cycle of the DC/DC converter by a
factor of 2, which helps to set the ratio between input and output voltage for
the MPPT algorithm more precisely.

Some restructuring of the half_bridge functions was necessary.
2020-09-21 12:45:22 +02:00
Martin Jäger 1356de230f Configure half_bridge PWM via board.dts and pinmux.c
Removes some of the hard-coded configuration in half_bridge.cpp and moves it
to board configuration.

The previous manual pinmux for the PWM output pins is now completely replaced
with Zephyr pinmux.
2020-09-21 12:45:22 +02:00
Martin Jäger 716fb367a8 Update development model in Readme 2020-09-16 15:47:30 +02:00
Martin Jäger 073c04967a Restructure ADC filtering and improve explanations 2020-08-31 13:53:35 +02:00
Martin Jäger f55b236a56 Update MCU-specific defines and includes
Distinguish properly between MCU series and actual MCUs. Constants in mcu.h
had to be changed to #defines to be useable from C code (not only C++).
2020-08-25 17:46:48 +02:00
Martin Jäger d274ca6980 Update PlatformIO ststm32 to 8.0.0
Fixes Zephyr compile issues https://github.com/platformio/zephyr/issues/5
2020-08-25 17:46:48 +02:00
Martin Jäger 314075545a Fix whitespace-check in Travis for PRs not to master 2020-08-19 15:55:15 +02:00
Martin Jäger 6be4e20f04 Make load OC and LVD recovery delay configurable 2020-08-19 15:55:15 +02:00
Martin Jäger ab63204adb Make battery configurable via Kconfig (fix #94)
Also adds crazy IS_ENABLED macro to unit tests.
2020-08-19 15:55:15 +02:00
Martin Jäger 5b024dcd60 Increase stack space for ts.process in serial.cpp
Depending on the amount of data nodes, calling ?rec caused a stack overflow.
Larger stack memory solves the issue, for further improvement see also #103.
2020-08-18 19:29:43 +02:00
Martin Jäger b110918797 Select serial port for ThingSet via Kconfig 2020-08-18 19:29:23 +02:00
Martin Jäger 5e5f2c6680 mppt_1210_rc: Use USART1 as debug serial 2020-08-18 12:14:59 +02:00
Martin Jäger c78c5431a4 Enable load short circuit comp for PWM 2420 LUS 2020-08-18 12:14:59 +02:00
azeemshatp 3aada5dbcc Fix trailing whitespace check in Windows and Linux
Previous check in check.bat considered only uncommitted changes.
2020-08-18 12:14:01 +02:00
Martin Jäger d2e833716a Add Grid_A to ThingSet data nodes 2020-08-17 19:59:58 +02:00
Daniel Fanache c8fa15a860 Remove executable bit for board definition files. 2020-08-17 19:59:58 +02:00
Daniel Fanache e427b45352 Use DT macros instead of Kconfig for board pinmux
Stops using CONFIG_device_x style configuration items and checks the
devicetree to determine if the nodes are enabled.

Fixes UEXT serial port not working.
2020-08-17 19:59:58 +02:00
Martin Jäger ee5846323f Fix STM32G4 ADC settings to improve accuracy
- Wait for the reference voltage to stabilize (thanks to yasen)
- Increase internal regulator stabilization period prior to calibration
2020-08-17 19:59:58 +02:00
Martin Jäger 176af4188f Increase serial watchdog timeout
This prevents the watchdog from kicking in while configuration is stored to
slow EEPROM integrated in STM32L072 MCUs.
2020-08-17 19:58:51 +02:00
Martin Jäger 445359c3b5 Make CAN publication frequency more accurate
Using K_TIMEOUT_ABS_MS for k_sleep calculate exact 1s interval.
2020-08-03 14:52:20 +02:00
Martin Jäger 8f96343cf1 Add support for Kconfig in src/custom
Also fixes data_nodes_custom.cpp inclusion based on Kconfig.
2020-07-27 17:53:31 +02:00
Martin Jäger bbd1312fe5 Relocate and clean up application Kconfig structure 2020-07-24 08:49:47 +02:00
Martin Jäger dc85b46477 Remove unused ExtInterface and ExtMgr 2020-07-23 19:27:45 +02:00
Martin Jäger 01650917fd Move ThingSet serial to dedicated thread 2020-07-23 19:18:24 +02:00
Martin Jäger 79ba9006e7 Move OLED display to dedicated thread 2020-07-23 18:31:52 +02:00
Martin Jäger 5e213fdfb1 Generate COMMIT_HASH define via CMake
Previously the commit hash was generated with a python script which was only
called by PlatformIO and caused issues when using Zephyr SDK directly.
2020-07-23 17:34:41 +02:00
Martin Jäger c2ef955a63 Replace custom print_* with Zephyr LOG_* 2020-07-23 17:34:41 +02:00
Martin Jäger 8e06357a7d Make CAN node ID configurable 2020-07-23 17:34:41 +02:00
Martin Jäger 70baedf95d CAN: Separate thread for pub messages 2020-07-23 17:34:41 +02:00
Martin Jäger 3b486f3193 Restructure SW watchdog and fix bug for >3 channels
The feed function considered max. number of channels and not actual number
of registered channels, which resulted in undefined behavior if not all
channels were used.

Also introducing more simple API to hide the software implementation.
2020-07-23 17:34:41 +02:00
Martin Jäger ed374e8e99 Remove CAN msg queue and update ThingSet lib 2020-07-23 17:34:41 +02:00
Martin Jäger dc4576c8b4 Remove all board.h files
Final updates to devicetree files (adding temperature sensor information) make
board.h files obsolete.
2020-07-23 17:34:41 +02:00
Martin Jäger 27cdcb3bf6 LED setup via devicetree
- New charlieplexing-leds binding
- board.dts files updated
- Pin and LED setup removed from pinmux.c and board.h files
2020-07-23 17:34:41 +02:00
Martin Jäger a584904470 Switch to new DT_ macros 2020-07-23 17:34:39 +02:00
Martin Jäger b8fe6d7023 Fix some static code analysis warnings 2020-07-23 12:55:38 +02:00
Martin Jäger 3012501358 Switch to Zephyr 2.3 and update pio check 2020-07-23 12:55:38 +02:00
Martin Jäger 6316dcd57f Add DC/DC HV side output enable switch 2020-07-23 12:55:38 +02:00
Martin Jäger 7dfcac4037 Add ADC reading to/from voltage conversions 2020-07-23 12:55:38 +02:00
Martin Jäger 7af7d1c4ee Add CAN ISO-TP support 2020-07-23 12:55:37 +02:00
Martin Jäger 3fcd27cdba Use separate CMakeLists.txt per directory 2020-07-23 12:41:32 +02:00
Martin Jäger 8a28d8bc22 Remove unused bootloader support 2020-07-23 12:41:32 +02:00
Martin Jäger 705abbed6b Remove broken ESP32 modem driver
This driver was only compatible with mbed and didn't work reliably. Zephyr
has an in-built ESP modem driver already.
2020-07-23 12:41:32 +02:00
Martin Jäger 2a3e50f6ca Add battery temp. sensor to MPPT 2420 RC 2020-07-23 12:41:32 +02:00
Martin Jäger a7f4ccaa91 Add CAN support for MPPT 2420 RC board
The CAN-FD driver is not yet in Zephyr master, so it is required to get
Zephyr PR 22832 to actually use CAN with this MCU.
2020-07-23 12:41:24 +02:00
Martin Jäger d283436747 Move ADC peripheral setup to devicetree
Remove the ADC channel configuration from the board.h files and use new
DT macros to configure the ADC peripheral based on board.dts only.
2020-07-20 09:07:31 +02:00
Martin Jäger 1b6c56d25b Replace adc-gain DT binding with adc-inputs
Preparation for cleanup of ADC driver.
2020-06-26 15:17:53 +02:00
Martin Jäger 3c9a6e49f1 Fix not enabled UART_1 for some boards 2020-06-26 14:36:36 +02:00
Rhushabh 1dc5cdd7ef Software watchdog for multiple threads 2020-06-23 15:59:31 +02:00
Martin Jäger 54bc5eaee8 Add MPPT 2420 RC board 2020-06-17 11:15:50 +02:00
Martin Jäger 3185ff32a1 Add support for Zephyr 2.3.0 (using west)
Enable CONFIG_LEGACY_DEVICETREE_MACROS and fix removed Kconfig values
like UART_1 to support v2.2 and v2.3.
2020-06-17 11:15:38 +02:00
Jordan Silverman a768f059a1 Stop energy counter when disabled 2020-06-16 21:23:07 +02:00
Martin Jäger 9f02287a03 Add custom unit-test option 2020-06-08 14:27:07 +02:00
Martin Jäger fb3251b88a Add HS MOSFET fail-safe protection Kconfig
The function already existed since a while, but was accidentally not activated.
This is fixed by this commit.
2020-06-05 17:24:16 +02:00
Martin Jäger fc0276e72c Allow custom DC/DC control functions
A Kconfig CUSTOM_DCDC_CONTROLLER is introduced to enable implementation of
more sophisticated control functions than the standard perturb and observe.

A function dcdc_low_level_controller() must be implemented and is called
from the DMA interrupt after each new current sensor reading.

The default Dcdc::control() function is defined __weak.
2020-06-05 16:22:41 +02:00
Martin Jäger 2875ea1519 Rename DC/DC control function responsible for MPPT 2020-06-05 16:18:20 +02:00
Martin Jäger 3eb70e9a01 Add test/zephyr.h to mock Zephyr functions/defines 2020-06-04 16:28:19 +02:00
Martin Jäger dfde83d8be Add CCR and ARR based functions to half_bridge 2020-06-04 11:51:42 +02:00
Martin Jäger b288ffdf35 Cleanup of half_bridge driver
Variables are now named same as registers to avoid confusion between duty
cycle as a value between 0 and 1 or as the capture/compare register value.
2020-06-04 11:51:42 +02:00
Martin Jäger a6c0eecf20 Small datatype updates to reduce RAM footprint 2020-06-04 11:51:42 +02:00
Martin Jäger 7769e4063c Allow more generic firmware customization
This commit adds a new Kconfig setting CONFIG_CUSTOMIZATION. If enabled, the
subdirectory src/custom is added to the build. It can contain an own
CMakeLists.txt file to add several different C/C++ files.

Readme has been updated to explain also DTS overlays and custom prj.conf files.
2020-06-04 11:50:09 +02:00
Martin Jäger 0e5e2f89b1 Remove outdated Kconfig options 2020-06-04 11:50:09 +02:00
azeemshatp cfed3ed6e9 Configure custom data nodes 2020-05-26 15:02:26 +02:00
Martin Jäger 81aefff168 Fix load overvoltage control for 24V systems (#96) 2020-05-21 10:09:54 +02:00
Martin Jäger 882f281333 Fix undervoltage error flag reporting
Load shedding should only trigger capacity calculation, but not set the
undervoltage flag. That flag is only set for voltage below absolute min.
2020-05-11 14:09:27 +02:00
Martin Jäger 1bd8734a2e Use K_MSEC macro in k_sleep calls
This is required by Zephyr 2.3, otherwise getting compile error.
2020-05-11 12:26:41 +02:00
Martin Jäger 9a5004e81d Fix DC/DC start check for 24V batteries (#95) 2020-05-11 11:01:47 +02:00
Martin Jäger faf19ee9e0 Fix wrong voltage divider in MPPT 2420 HPX 2020-05-11 10:32:49 +02:00
Martin Jäger e1c7f97f63 Add support for devices without load output 2020-05-11 10:32:24 +02:00
Martin Jäger d292ad425a Add PWM switch off inhibit 2020-05-06 12:53:26 +02:00
Martin Jäger 3d4da66955 Generate DeviceID from hwinfo 2020-05-06 12:53:26 +02:00
Martin Jäger efc0bc8fdc Update to ThingSet library v0.3 2020-05-06 12:53:26 +02:00
Martin Jäger 7da96abbe4 Fix Solar_V enable and use float for gain calc 2020-05-06 12:53:26 +02:00
Martin Jäger f2c063b291 Lock PlatformIO to Zephyr v2.2.0 2020-05-06 12:53:26 +02:00
Martin Jäger 5e94d72117 Use LL for PWM switch driver to support STM32G4
This adds support for PWM solar input of MPPT 2420 HPX. Also adds new
PwmSwitch::test() function.
2020-05-06 12:53:26 +02:00
Martin Jäger 4011370646 MPPT-2420-HPX: Use TIM8 for charge pump
This commit implements the PWM driver manually using STM LL, as the Zephyr
driver doesn't work for "advanced" timers like TIM8.
2020-05-06 12:53:26 +02:00
Martin Jäger e76709f2af Enable load short circuit comparator
The load driver had to be moved to a .c file to allow attaching interrupt
in Zephyr.
2020-05-06 12:53:26 +02:00
Martin Jäger 9f258b6e69 Replace short STM32XXX defines with CONFIG_SOC_... 2020-05-06 12:53:26 +02:00
Martin Jäger c856b28082 Cleanup of comments in bat_charger.h 2020-05-06 12:53:26 +02:00
Martin Jäger 6f490df537 Small fix of data object units 2020-05-06 12:53:26 +02:00
Martin Jäger 9787397708 Rename STM32L073 references to actually used STM32L072 2020-05-06 12:53:26 +02:00
Martin Jäger 8380b928df Fix Solar_V data object for PWM CCs 2020-05-06 12:53:26 +02:00
Martin Jäger a412117b5b New adc-gain devicetree binding 2020-05-06 12:53:26 +02:00
Martin Jäger 4a70293375 Update peripheral pins in board.dts and pinmux.c 2020-05-06 12:53:26 +02:00
Martin Jäger 8dd576e40e Configure PWM switch driver via DTS
Driver now moved to separate .c file to allow ISR handling in Zephyr.
2020-05-06 12:53:26 +02:00
Martin Jäger ce7f63b888 Introduce generic "outputs" DTS binding
Replaces previous "switch" and "pwm-out" bindings and allows to reference
either gpio or pwm handle and specify maximum current.

Also replacing CONFIG_HAS_LOAD and CONFIG_HAS_USB_PWR with DT_ variants.
2020-05-06 12:53:26 +02:00
Martin Jäger 90c1e7fcf5 Replace Zephyr ADC driver with direct LL access
Fixes IRQ conflict with COMP peripheral (#93)
2020-05-06 12:53:26 +02:00
Martin Jäger 2d3594d254 Add watchdog for each thread using Zephyr API 2020-05-06 12:53:26 +02:00
Martin Jäger 1252a1ffa1 Make default battery type configurable via Kconfig 2020-05-06 12:53:26 +02:00
Martin Jäger d2dd50fe99 Add ThingSet passwords to Kconfig 2020-05-06 12:53:26 +02:00
Martin Jäger 5523f93544 Handle PCB versioning with DTS overlays
This commit completely removes versions like _0v4 in board names
and adds DTS overlays to zephyr/ directory. These can be used to
compile for older board versions.

Some additional configuration changes are handled in board.h file
using board version number from DT_CHARGE_CONTROLLER_PCB_VERSION_NUM.
2020-05-06 12:53:26 +02:00
Martin Jäger affaa9d8e8 Move PCB type and version to DTS 2020-05-06 12:53:26 +02:00
Martin Jäger 4e6f6c7365 Move thermal model parameters to DTS 2020-05-06 12:53:26 +02:00
Martin Jäger 38125f3da3 Remove redundant CONFIG_NUM_LED_PINS 2020-05-06 12:53:26 +02:00
Martin Jäger ab504e3dfa DC/DC and PWM switch configuration via DTS
As these settings are clearly hardware-specific, configuration was
moved from Kconfig (hidden symbols) to DTS. New bindings added.
2020-05-06 12:53:26 +02:00
Martin Jäger 64b771cd42 daq: Separate current offset for DC/DC and PWM 2020-05-06 12:53:26 +02:00
Martin Jäger c25640b987 Fix blocking if CAN not connected to bus 2020-05-06 12:53:26 +02:00
Martin Jäger 9efa2f8f77 Use Zephyr EEPROM driver 2020-05-06 12:53:18 +02:00
Martin Jäger 2a71d02aeb Move PCB and user config to board Kconfig
Files in src/pcbs/xyz.h are moved to boards/xyz/board.h. User settings from
src/config.h are also configured via Kconfig, so the file is removed.
2020-04-30 10:53:58 +02:00
Martin Jäger 2d74a3a554 Mbed support removed
Rationale: The support for both Zephyr and Mbed made the code confusing,
especially because of many ifdefs.

Zephyr RTOS is the future!
2020-04-04 08:21:43 +02:00
Martin Jäger 2c2e59c072 Synchronize ADC2 with PWM signal
For boards with STM32G431, the ADC2 is used for fast current measurement,
synchronized with the half bridge switching PWM.
With this change, the ADC2 is triggered in the center of high-side
MOSFET ON signal using a second PWM output of TIM1.
2020-04-02 12:32:43 +02:00
Martin Jäger 91d4ec4424 Fix COMP and ADC interrupt conflict for STM32L0
The STM32L0 uses the same interrupt for ADC and COMP, which creates
interference with the Zephyr ADC driver. Proper fix needed!
2020-03-11 15:11:55 +01:00
Martin Jäger 84f7a4afdd STM32G431: Add VREF+ pin and fix ADC calibration
- Output 2.048V to VREF+ pin is now used as reference for ADC and DAC.
- ADC calbration got stuck before. Explicitly disabling ADC fixed the issue.
2020-03-03 11:15:58 +01:00
Martin Jäger daf43fb967 USB charging output control via LoadOutput class
- Introduce new CONFIG_HAS_USB_PWR_OUTPUT
- Improve charger.discharge_control function
- Add battery empty flag
2020-03-02 11:55:38 +01:00
Martin Jäger 1a9c290485 Charger.num_batteries moved to DcBus.series_multiplier
The reason is that the voltage disconnect thresholds used in the load outputs
need to be multiplied with number of batteries aswell. As the DcBus class
should contain all voltage-relevant information, it is the right place for the
multiplier.
2020-03-01 09:48:35 +01:00
Martin Jäger 651f66616b Add load info variable (combines state and error_flags) 2020-02-29 13:39:34 +01:00
Martin Jäger a20644f145 Update documentation (docs folder)
Outdated information removed and a new firmware structure overview added.
2020-02-28 14:39:02 +01:00
Martin Jäger 0e918e6b2e Add pwm-out DTS binding and fix CONFIG_PWM
The binding .yaml was forgotten in previous charge pump commit. CONFIG_PWM was
moved from prj.conf to board_defconfig as not all boards need the PWM driver.
2020-02-28 13:24:25 +01:00
Martin Jäger 7722f12a0c Add DAC current sensor ref for STM32G4 MCU 2020-02-26 19:36:27 +01:00
Martin Jäger 46630f88cb Enable half bridge for STM32G4 MCU 2020-02-26 19:30:59 +01:00
Martin Jäger 8307314000 Fix MPPT 2420 HPX pinmux and dts for I2C support 2020-02-26 18:22:16 +01:00
Martin Jäger 2154a1cb72 Add charge-pump driver for HS load switch 2020-02-21 18:27:42 +01:00
Martin Jäger fa9d15e796 Separate load and USB out, improve state handling
Identified issues:
- The load output and USB charging port shared the same state machine,
  which did not allow to set different switch-off thresholds.
- Load error codes were global, so it was not possible to have multiple
  load instances.

This commit introduces load-specific error_flags, makes the LoadOutput
class inherit from PowerPort (to improve code readability), separates
the load driver better from higher level implementation and adds a
second LoadOutput object for the USB charging port.
2020-02-21 18:27:36 +01:00
Martin Jäger 3c0bc41164 Add ADC2 channel configuration for STM32G4 board
Some changes regarding DMA setup and data alignment were necessary to
store all values from ADC1 and ADC2 in the same adc_readings array.
2020-02-20 11:07:02 +01:00
Martin Jäger d40dafd8d9 Rename V_SOLAR/BAT pins to more generic V_HIGH/LOW 2020-02-20 11:06:44 +01:00
Martin Jäger 8539fa3557 MPPT 2420 HPX: Add reset after flashing 2020-02-19 14:44:51 +01:00
Martin Jäger 0c20545f88 Differentiate between src and sink droop res again
Necessary for improved load disconnect switch behavior.
2020-02-19 14:34:40 +01:00
Martin Jaeger 6af8e6d93d Improve load voltage limits setup and update 2020-02-19 14:34:40 +01:00
Martin Jaeger cdb9183c11 Fix load overvoltage limit
The setting is now based on LoadOutput menber overvoltage and not
on the bus voltage bounds, which are used for charging setpoint.
2020-02-19 14:34:40 +01:00
Martin Jaeger 68e0336279 Add debounce counter for UV error detection
This prevents switching off the load output due to short undervoltage
events during startup of pumps etc. when the battery is at low SOC.
2020-02-19 14:34:40 +01:00
azeemshatp b717dea6d1 Implement ADC 1 & 2 using low level APIs
ADC2 works for STM32G431RB processor using LL drivers.
Keep the changes in the MPPT 'boards' folder for possible future use with
zephyr drivers.
2020-02-19 14:33:49 +01:00
JordanSilverman 30968e471c Check incoming battery conf 2020-02-17 19:47:51 +01:00
Martin Jaeger 08974169ab Use new Zephyr 2.2 GPIO driver API features
Enable and disable pins are now handled the same using _set function
instead of _write and using ACTIVE_HIGH/LOW setting in dts.
2020-02-13 18:35:42 +01:00
Martin Jaeger c4d4372953 Fix board files for Zephyr 2.2 compatibility
Warning: These changes break compatibility with previous v2.1.
2020-02-13 17:30:19 +01:00
azeemshatp 9b2162b12e Fix ADC-DMA support for STM32G431
Added additional clock setting for DMA and enabled DMAMUX.
2020-02-12 11:12:55 +01:00
Martin Jaeger 14249492a3 Improve full charge detection and topping control
The battery is only full if the topping voltage is still reached AND the
current is below cut-off threshold at the same time. This was not always
detected correctly with previous 2s target voltage monitoring interval.

In addition to that, a new timer was introduced to count seconds at target
voltage and improve full charge detection due to timeout.
2020-02-10 12:47:32 +00:00
Martin Jaeger 5f1d76ef74 Dedicated setup.cpp to clean up main.cpp
Also includes update of timestamp calculation in Zephyr.
2020-02-08 11:08:58 +01:00
Martin Jaeger 7940acccf4 Zephyr: STM bootloader activation added 2020-02-07 17:36:19 +01:00
Martin Jaeger 5dda805dab Zephyr: ThingSet reset function added 2020-02-07 17:24:07 +01:00
Martin Jaeger 43f90eea7c Move voltage control parameters to DcBus class
The sink and source voltage boundaries for droop control and battery
charge voltage management are now part of the DcBus class.
Also added source and sink current margins, which will be used by the
DC/DC for control targets instead of port current limits, which were
difficult to synchronize before.
2020-02-07 12:03:25 +01:00
Martin Jaeger a7d6dbc3b5 Let PWM switch class inherit from PowerPort
First step of unifying different ports connected to one bus. At a later
step, also the load and charger classes should inherit from PowerPort
class to make overall charge controller structure more clean.
2020-02-07 12:00:59 +01:00
Martin Jaeger f0e99cd80f Voltage replaced by DcBus ptr in PowerPort class
Preparation to separate current and voltage measurements and control
parameters into DcBus and PowerPort classes. This will help to
manage current from different sources (grid, solar) going towards
one bus and control the battery voltage. It will also help to align
multiple charge controllers in parallel, communicating via CAN bus.
2020-02-07 11:55:51 +01:00
Martin Jaeger 86bfce8a0c Zephyr: Added solar voltage enable switch 2020-02-05 18:06:17 +01:00
Martin Jaeger 20fbefc19b Zephyr: DAC using LL added for STM32L0 and STM32F0 2020-02-05 18:06:11 +01:00
Martin Jaeger c31f8d5014 Fix PlatformIO debug error in ext.cpp
Without this dummy implementation of std::__throw_bad_alloc() the
linker was throwing errors.
2020-02-05 18:06:06 +01:00
Martin Jaeger 83d7c36778 Zephyr: MPPT 1210 HUS 0v7 board added 2020-02-05 18:05:55 +01:00
Martin Jaeger 3a8103457f Add type-checking to data objects map 2020-01-31 14:50:32 +01:00
Martin Jaeger 1b6a7f82d7 Zephyr: CAN support added
So far, only publishing messages are supported (no RX yet).

Logging is switched on again, but with minimal output only (suitable
for small F0 MCUs). CAN is activated by default for MPPT 2420 LC.
2020-01-30 16:54:58 +01:00
Martin Jaeger e078b87553 Zephyr: MPPT 2420 LC board added 2020-01-29 11:03:09 +01:00
Martin Jaeger 81c0764f2c Fix DMA memory access violation (wrong length setting) 2020-01-28 15:28:46 +01:00
Martin Jaeger 8c3a6b7160 Zephyr: EEPROM for STM32L0 working 2020-01-28 14:23:47 +01:00
Martin Jaeger eed8c9114c Coding style updated/fixed
Indentations of class definitions and preprocessor statements were not
uniform throughout the code. This commit cleans up indentations as well
as the order of include statements.

Style conventions see: https://github.com/LibreSolar/coding-style
2020-01-28 13:20:01 +01:00
Martin Jaeger c04081fc8a Make Serial and OLED configurable via Kconfig 2020-01-28 12:13:54 +01:00
Martin Jaeger 05292c12ba ADC & DMA renamed to DAQ (data acquisition) 2020-01-27 15:13:53 +01:00
Martin Jaeger dc394cc198 DC/DC: HS MOSFET fail-safe protection enabled 2020-01-27 15:12:15 +01:00
Martin Jaeger a457c2cc9b Fix DC/DC startup condition check 2020-01-27 14:41:48 +01:00
Martin Jaeger 24f751b2e5 Initial support of MPPT 2420 HPX board
- Some flags changed to make the firmware compile for new STM32G431 MCU
- Zephyr board definition added
- Serial, OLED display and LED working
- ADC compiling, but not yet working
2020-01-23 14:41:44 +01:00
Martin Jaeger d5ce578aeb Zephyr: DMA setup via LL instead of registers 2020-01-23 09:51:58 +01:00
azeemshatp 64bd1930b0 Support continuous integration test in Windows.
The 'check.bat' file is introduced to support continuous integration test locally in windows environment. The batch file may be run from Windows command prompt.
2020-01-23 08:06:13 +01:00
azeemshatp f830389c33 Implemented Thingset Serial functionality in Zephyr framework.
Implemented using UART driver APIs.
2020-01-23 08:06:13 +01:00
Martin Jaeger 41b4607cc7 Fix additional bug in load unit-test 2020-01-20 15:22:21 +01:00
Martin Jaeger 69747a588d Fix initialization bug in load unit-test 2020-01-20 10:41:48 +01:00
Martin Jaeger 10f7d44bdf Zephyr: Load output added
Overcurrent protection in PWM charge controller not yet working for Zephyr.
2020-01-18 16:30:37 +01:00
Martin Jaeger d5ea6b5653 Zephyr: Custom DTS binding for GPIO switch
Previously, the LED binding was abused. DTS is now much cleaner.
2020-01-18 15:56:57 +01:00
Martin Jaeger 0c01c3d013 Fixed wrong initialization of static Wh counters 2020-01-16 20:21:08 +01:00
Martin Jaeger a76b92c27b time(NULL) replaced with uptime() in helper files
Reason: Zephyr does not support time(NULL). This way it is portable.
2020-01-16 20:04:37 +01:00
Martin Jaeger 632eb5a4f7 Zephyr: ADC HAL replaced with LL 2020-01-16 16:21:21 +01:00
Martin Jaeger 27bb53bbeb Zephyr: ADC based on STM HAL working 2020-01-16 12:24:25 +01:00
Martin Jaeger cb988639ce Zephyr: Added PWM 2420 LUS board 2020-01-09 13:56:02 +01:00
Martin Jaeger 04f0d42970 Zephyr board names unified with mbed code 2020-01-07 09:38:10 +01:00
Martin Jaeger 90f4c9af00 ThingSet and OLED libs added as git submodules 2020-01-07 07:40:46 +01:00
Martin Jaeger e1915ab501 Releases mentioned in README.md 2020-01-06 19:27:13 +01:00
Martin Jaeger 16ca793bb3 Port configuration based on Kconfig implemented 2020-01-06 19:16:44 +01:00
Martin Jaeger 7bd9bdeafd Kconfig: User-configuration added 2020-01-06 19:05:09 +01:00
Martin Jaeger d654324860 Charger-specific features added to Zephyr board spec
Hardware features like PWM switch, DC/DC converter and LED config
are now configured in the board definition. Actual source files still
need to be changed to use defines with CONFIG_ prefix instead of
defines from pcb.h.
2019-12-31 13:19:26 +01:00
Martin Jaeger 7f4aaf97c3 Moved cal register definitions to mcu.h 2019-12-31 13:16:14 +01:00
Martin Jaeger 93418fc8c8 Fixed basic nanogrid port implementation
Instead of SOLAR_TERMINAL, GRID_TERMINAL has to be defined in config.h
(see also template).
2019-12-20 14:52:57 +01:00
Martin Jaeger 53ae6d4608 File headers shortened using SPDX-License-Identifier 2019-12-20 11:40:10 +01:00
Martin Jaeger 7f72d17164 Readme: Added instructions for Zephyr 2019-12-20 11:02:44 +01:00
Martin Jaeger dc270372af OLED display integrated with Zephyr
- Some fixes in DTS and pinmux settings
- Supporting different I2C address definitions of mbed and zephyr
- Thread for ext_mgr added
2019-12-20 10:51:00 +01:00
Martin Jaeger 117455390b OLED library refactoring to prepare Zephyr integration
- 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
2019-12-20 10:44:53 +01:00
Martin Jaeger 8c3c08df26 Removed broken mbed USB CDC libraries 2019-12-20 10:44:21 +01:00
Martin Jaeger 3f89943edf ThingSet interfaces merged with Ext interfaces 2019-12-20 10:43:51 +01:00
Martin Jaeger 4326d74fe2 UExt interfaces simplified and renamed to Ext 2019-12-20 10:42:45 +01:00
Martin Jaeger 7633dc1d93 Zephyr: Clock setup fixed and LEDs implemented 2019-12-20 10:41:53 +01:00
Martin Jaeger 62f2f1978c UEXT and ThingSet code moved to ext folder 2019-12-20 10:38:31 +01:00
Martin Jaeger 88148e70cb Initial compiling Zephyr integration 2019-12-20 10:37:50 +01:00
Martin Jaeger b87d223dff Conformance testing script check.sh added 2019-11-21 08:34:55 +01:00
Martin Jaeger 67c5bc5504 Check for trailing whitespaces added to TravisCI
Rationale: Many editors (inclding mine) are set to automatically remove
trailing whitespaces. Updating files with trailing spaces creates distracting
additional lines in diffs.
2019-11-21 07:45:16 +01:00
Martin Jaeger 74b765e801 Trailing white spaces removed 2019-11-21 07:44:15 +01:00
Martin Jaeger 7952ac99b0 Subfolder img with OLED bitmap raw files removed 2019-11-21 07:38:32 +01:00
Martin Jäger 0086a739ad Create CONTRIBUTING.md 2019-11-11 21:43:49 +01:00
Martin Jäger a209761fd9 Create CODE_OF_CONDUCT.md 2019-11-11 21:02:26 +01:00
Martin Jaeger ad27142cd8 Fix DC/DC and PWM switch current limit control (#79) 2019-11-11 19:33:30 +01:00
Martin Jaeger ad99d0a361 Static code analysis activated in PlatformIO 2019-11-11 18:35:21 +01:00
Martin Jaeger 47954166be Fine-tuning of battery/load UV/OV alerts
- 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
2019-11-11 11:38:34 +01:00
Martin Jaeger f254c77ab6 Refactoring of load control and state machine
- 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
2019-11-11 09:35:26 +01:00
hogthrob d1ff837c5e Overvoltage limit overflow fix (#80)
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.
2019-11-10 17:55:43 +01:00
hogthrob 1536e176a9 Better limit for input power derating (#78)
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.
2019-11-10 15:13:30 +01:00
hogthrob ba7d379225 Refactored adc_dma.cpp for readability (#76)
- 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
2019-11-09 23:13:00 +01:00
hogthrob 5cc4921cd2 Small issue fix for OLED (#77) 2019-11-09 12:35:45 +01:00
hogthrob a600bf8a09 OLED display brightness adjust, reset improvement, SOC display and more (#75)
- 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
2019-11-09 08:22:28 +01:00
Martin Jaeger c26c17221a Overvoltage alert improved for PWM switching
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.
2019-11-08 13:06:17 +01:00
hogthrob 71fd6519bc Fix for ADC randomly misconfigured (#74)
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.
2019-11-08 07:29:04 +01:00
Martin Jaeger 328215dc8e Load overvoltage detection corrected and error flag comments added 2019-11-07 16:00:51 +01:00
Martin Jaeger 4c5401d562 PWM switch max current limit control fixed 2019-11-06 10:49:40 +01:00
Martin Jaeger 2992cebb81 Fixed internal temperature data output 2019-11-06 10:17:49 +01:00
Martin Jäger b0fe567884 Merge pull request #73 from LibreSolar/adc-alerts
ADC alerts for faster over/undervoltage detection
2019-11-06 10:10:31 +01:00
Martin Jaeger 5e3181f5e5 Distinguishing between OV and UV alerts, inhibit added
- 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
2019-11-05 18:43:33 +01:00
Martin Jaeger 7874b8b4d6 ADC alerts and emergency stop functions added
Check for overvoltage/undervoltage conditions after each ADC reading cycle and
trigger alert (stopping DC/DC, PWM switch and load output) if limits exceeded.
2019-11-04 18:12:00 +01:00
Martin Jaeger 7412b11002 ADC filtering in separate function + unit-tests 2019-11-04 18:02:43 +01:00
hogthrob bc8f74aa45 Multiple UExt objects at same time (#68)
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.
2019-11-04 09:23:37 +01:00
hogthrob bec02cb25b Switched to use power of 2 error numbers (#72)
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.
2019-11-04 09:19:06 +01:00
hogthrob fd474e5350 Use methods to set/clear/query error flags (#71)
Easier to read, quicker to write (if using code
completion), no performance loss due to inlining.
2019-11-02 08:22:00 +01:00
Martin Jaeger b09f4ca809 More error flags added and defined as output data object 2019-11-01 12:58:31 +01:00
Martin Jaeger 22f9138a15 LogData renamed to DeviceStatus / dev_stat
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.
2019-11-01 09:54:01 +01:00
Martin Jaeger af4af04697 Fix initialization of load.voltage_prev 2019-11-01 08:53:51 +01:00
Martin Jaeger b974e3c1ba PWM 2420 PCB conf updated after testing 2019-11-01 08:37:08 +01:00
Martin Jaeger c70f4cb2c3 Support for custom configuration added to platformio.ini 2019-11-01 08:18:57 +01:00
Martin Jäger a147bdf81b Merge pull request #67 from LibreSolar/load-protection-improvements 2019-11-01 08:15:08 +01:00
Martin Jaeger 20bc6d124b Fix to prevent toggling between load states disabled and low SOC 2019-10-31 19:50:55 +01:00
Martin Jaeger cb0c3c8135 USB output state machine improved (see #69) 2019-10-31 16:32:03 +01:00
Martin Jaeger b98461fee4 Load off for internal overtemp implemented 2019-10-31 12:07:21 +01:00
Martin Jaeger b1a7babaff Load overcurrent model now using internal temperature 2019-10-31 11:33:18 +01:00
Martin Jaeger b0e265f3e9 NTC on PCB not used as battery temperature anymore
- 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
2019-10-31 11:22:03 +01:00
Martin Jaeger 5b4df98656 Load protection improvements
- 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
2019-10-30 17:31:16 +01:00
Martin Jaeger 975c03affd Load OC/UV recovery settings fixed 2019-10-30 15:13:58 +01:00
azeemshatp 6bc2adb793 Bootloader support for STM32L07x MCUs (#65)
A custom linker script (.ld) is added to the root project folder. platformio.ini file updated to add the new env: pwm-2420-lus-v0.3-bl and build_flags. Start address for each Application in the flash need to be is modified in this .ld file. Readme file is updated accordingly. New functions added to perform flash write operations to store the bootloader status.
2019-10-28 13:30:19 +01:00
hogthrob e67123ac62 DCDC transfer doesn't work fix for STM32F0 based boards (#66) 2019-10-27 13:57:15 +01:00
Martin Jäger f14df2bc9d Global print functions based on debug level flags added (closes #58) 2019-10-25 11:36:01 +02:00
Hogthrob 88f2accbd9 Reduced code duplication in dcdc code 2019-10-24 17:06:11 +02:00
Martin Jaeger a7239fa9bb Enabled all warnings for unit-test builds 2019-10-24 16:10:35 +02:00
Martin Jaeger 68ae3227cc Discharge and load output control improvements
- Charge/discharge control in charger class sets global error flags
- Load state machine analyzes error flags to distinguish reasons for switching load off
- Temperature errors now identified correctly (issue #59)
- Delay before load re-connect after low voltage or overcurrent event now configurable
- Unit tests added
2019-10-24 16:04:32 +02:00
Martin Jäger 2beb72f1f6 Merge pull request #62 from LibreSolar/playground
Rework of port concept and charge controller type setup
2019-10-24 15:58:19 +02:00
Martin Jaeger ba10a2882c Fixing load output and improved overvoltage config
Previous load output expected the battery port as a parameter and checked if
discharging of the battery was allowed. New implementation has own load port
and needs to check if current output (i.e. positive direction) is allowed.

Overvoltage setting is now configured via power port sink_voltage_max.
2019-10-23 13:16:04 +02:00
Martin Jaeger 42751c83c2 PowerPort member variables renamed
Previous naming with chg/dis didn't make much sense e.g. for load output or solar panels. Voltage
targets are now named with source or sink. Current limits are defined based on their direction
(negative or positive). ASCII art graphic added for better explanation of passive sign convention.
2019-10-23 10:32:48 +02:00
Martin Jaeger 515b098e85 Passing of bat voltage and current limits to other ports updated 2019-10-23 07:29:05 +02:00
Martin Jaeger f879dc9c5d DC bus integrated into PowerPort class
Reason: Previous idea with storing the voltage only once and not in every port
doesn't work well for droop settings, e.g. the DC/DC output port doesn't know
the actual battery current, which should be used to calculate the droop caued
by wire resistance.
2019-10-22 18:23:19 +02:00
Martin Jaeger a89ac7ff4b Fixing not working references to bat/solar ports in data_objects 2019-10-21 18:00:27 +02:00
Martin Jaeger 8558cef9cb PWM switch also implemented as class 2019-10-20 22:01:45 +02:00
Martin Jaeger b5c7f396e1 PowerPort configuration for different charger types improved
- Solar and battery ports now defined as references to actual hardware ports at very beginning of main.cpp, allowing to use the references also in data_objects.cpp
- Different charger types (PWM / MPPT) are configured more clearly by switching on/off features (DC/DC, PWM switch and load) in PCB configuration
2019-10-20 17:44:32 +02:00
Martin Jaeger 0399c4e877 PowerPort added to store current independent from DC bus type
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.
2019-10-20 14:52:35 +02:00
hogthrob c5fd08d836 Fix rounding issue (#60)
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.
2019-10-20 13:50:56 +02:00
Martin Jaeger d7ed3cdd13 STM32 bootloader activation from SW via BOOT0 pin 2019-10-18 17:01:33 +02:00
Martin Jaeger 29e186624c ThingSet device renamed to interface
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.
2019-10-17 10:36:48 +02:00
Martin Jaeger 6c3885e5d0 Log unit-tests added 2019-10-16 21:32:35 +02:00
Martin Jaeger f33146e9de Battery discharging control restructured
- 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
2019-10-16 16:04:21 +02:00
Martin Jaeger cce6e2a9b3 Added main.h for common includes and extern variables 2019-10-16 12:03:49 +02:00
Martin Jaeger 0545131a99 Equalization charging phase added 2019-10-16 10:02:27 +02:00
hogthrob 472fb03cc6 Small fix for building unit test on Windows (#56)
Was necessary to add -D __STDC_FORMAT_MACROS for MinGW gcc 8.1.0
2019-10-16 06:29:12 +02:00
Martin Jaeger aeeff56492 Update mbed to v5.13.4 after testing 2019-10-15 16:48:14 +02:00
Martin Jaeger 6d91e075b3 Update of DC/DC lv side targets based on bat + load 2019-10-15 16:46:24 +02:00
Martin Jaeger 25e469516c DC/DC control functions cleaned up 2019-10-15 14:00:20 +02:00
Martin Jaeger ae51d7a0d7 Unit tests for DC/DC control added 2019-10-15 13:59:48 +02:00
Martin Jaeger e7317ae1d8 DC bus and terminal naming improved
- 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
2019-10-15 13:57:23 +02:00
Martin Jaeger cb206b6864 DC/DC startup check reworked and unit-tests added 2019-10-15 13:54:05 +02:00
hogthrob 11e3a3e102 Fixed -Wno-register added to C compiler calls (#55) 2019-10-15 13:45:04 +02:00
hogthrob 6d56003c8c Unified half bridge timer handling (#53)
* As much as possible code is shared between both timer abstractions.
* Unit tests added to main implementation file (stub removed)
2019-10-15 10:34:53 +02:00
Martin Jaeger fb11fb7cb4 Fix for false PWM 2420 LUS v0.3 load current measurement 2019-10-14 10:52:19 +02:00
Martin Jaeger e94af324ee Board definitions updated for MPPT 1210 HUS v0.7 2019-10-08 15:19:05 +02:00
Martin Jaeger 4c2e05a9a1 Fix encoding in python version file generator 2019-10-08 15:15:29 +02:00
hogthrob 3fc395d333 Fix build issue with mbed 5.13 (#52) 2019-10-08 15:12:47 +02:00
hogthrob 987a6d8894 Increase Efficiency: Use MPPT mode more often (#49)
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
2019-10-01 14:40:16 +02:00
Hogthrob 7e1d1374a2 Fix startup block with USB serial adapter connected
We were using the "wrong" readable method which always returned readable == true but getc on serial will block if no data is available.
2019-08-28 17:41:04 +02:00
Hogthrob 41f142c112 Readded sleep code to make it work 2019-08-28 17:40:40 +02:00
Hogthrob 4764e0a5d0 Improved command input
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
2019-08-28 17:39:32 +02:00
Hogthrob a1098aaf71 ThingSetDevice classes
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.
2019-08-28 17:37:05 +02:00
hogthrob 01edcbcf07 Fix for #44 (Wrong DCDC power calculation) (#45)
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.
2019-08-26 07:36:13 +02:00
Martin Jaeger 3f4f52ea18 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
2019-08-16 11:37:25 +02:00
Martin Jaeger e51a6384fb Fixing bug in load overvoltage protection 2019-08-16 07:48:56 +02:00
Martin Jäger 152e218e60 Corrected upload protocol in platformio.ini 2019-08-08 15:58:26 +02:00
Martin Jaeger 0a2a38691b 12V/24V battery detection message updated (closes #43) 2019-08-08 11:36:13 +02:00
Martin Jaeger 4b545fa882 Include git commit hash in ThingSet data objects 2019-08-08 11:19:29 +02:00
Martin Jaeger c968a6bb8a Structs renamed for new coding style (closes #42) 2019-08-08 10:16:16 +02:00
hogthrob 3261414fcf uext_wifi compiles again (#41) 2019-07-26 07:38:06 +02:00
Jordan Silverman 45e29e1c82 Merge pull request #40 from LibreSolar/lvd-improvements
Load voltage thresholds adjusted and inhibit added
2019-07-17 14:42:09 +01:00
Martin Jaeger 4bc3f8bd1e Load voltage thresholds adjusted and inhibit added
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.
2019-07-12 18:55:13 +02:00
Martin Jaeger 17b044d941 Improve SOC and load LED behavior at low SOC
This commit prevents that the SOC bar shows 2 LEDs already even though the load is still switched of because of low voltage.
2019-07-11 17:50:40 +02:00
Martin Jaeger 3a2af7ccc7 Rewrite of LED module (closes #28) 2019-07-11 17:19:06 +02:00
Martin Jaeger cf5366c2ba Fix usable_capacity estimation to prevent wrong values before first full charge 2019-07-11 13:11:34 +02:00
Martin Jaeger 5e48d5e7c5 Update to PlatformIO 4.0 2019-07-10 21:15:22 +02:00
Martin Jaeger 7300406b94 DC/DC test function and dead time config added
- 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.
2019-07-05 11:01:35 +02:00
hogthrob 7ee248cf81 Reduced codesize: Switch to newlib-nano; Travis deploy on LibreSolar only (#37)
* 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.
2019-07-01 14:30:11 +02:00
Martin Jaeger 26ae254ec4 Fixing load overvoltage protection (closes #27) 2019-06-25 09:14:57 +02:00
hogthrob 14faa1f0e8 Working CAN (#35)
* 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
2019-06-23 00:41:01 +02:00
hogthrob 7d02c92c7d Fix to move data_objects to flash only (#36)
Without this, the 1296 byte long data_objects is stored in RAM
(after being copied from flash)
2019-06-23 00:32:13 +02:00
hogthrob a4d5243286 Fixed Load_A not correctly reported issue (#34)
At compile time &(load.bus->current) will resolve to a different
(wrong) address than after assignment of "load_bus" to load.bus at runtime.
2019-06-22 12:52:37 +02:00
hoijui 6016c17b14 Minor code improvements from CppCheck & README updates (#32)
* 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
2019-06-22 08:04:32 +02:00
hogthrob 32005a5642 Reduce stack usage: Make logo stored in flash, fix oled (#33)
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).
2019-06-22 07:29:40 +02:00
Martin Jäger b3aada7d4e Merge pull request #31 from hogthrob/master
Fixed NMC battery configuration calculation
2019-06-20 07:43:39 +02:00
Hogthrob f26fdce41f Fixed NMC battery configuration calculation
Now num_cell multiplier is used in all required places.
2019-06-20 07:26:39 +02:00
Martin Jaeger 690e204a16 Solar, bat and load power added to data objects 2019-06-18 17:04:33 +02:00
Martin Jaeger 375fcee514 New ThingSet features pub and auth included 2019-06-18 14:20:14 +02:00
Martin Jaeger ead6f2bffb Several small fixes for MPPT-2410-LC
- 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!
2019-06-16 15:50:01 +02:00
Martin Jaeger 96d26b5c34 Fixing stalled MCU if solar is connected before battery
(the change in dcdc.cpp fixes the failed unit-test in previous commit, which didn't find min/max functions)
2019-06-16 14:46:54 +02:00
Martin Jaeger 15d5f0ee71 DC/DC startup delay added to allow voltages to stabilize 2019-06-16 13:24:49 +02:00
Martin Jäger 4ee2353678 Merge pull request #29 from hoijui/patch-1
README: move setup before flashing & formatting
2019-06-13 15:06:45 +02:00
hoijui 4e70fc8917 README: move setup before flashing & formatting
Makes it a bit more newb-friendly, I think (being a newb).
2019-06-13 14:55:22 +02:00
Martin Jaeger 36cccfb63d DC/DC start duty cycle adjusted to reduce stress
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.
2019-06-13 11:51:31 +02:00
Martin Jaeger 0e91c834ac Faster load short circuit protection via LPTIM
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.
2019-06-12 09:45:19 +02:00
Martin Jaeger f0301625d7 PCB names updated according to new type convention 2019-05-29 21:49:50 +02:00
Martin Jaeger d13d5263b0 10A MPPT v0.6 PCB definition updated 2019-05-29 21:23:32 +02:00
Martin Jaeger 5a264e9332 Load short circuit protection using analog COMP2
- 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
2019-05-27 16:41:30 +02:00
Martin Jaeger 977002b0e7 Sign for discharged Ah counter corrected 2019-05-27 11:21:35 +02:00
Martin Jaeger dec36143dd 12V/24V detection added and bat_charger restructured 2019-05-23 22:16:41 +02:00
Martin Jaeger b742fe6671 Energy calculation for PWM CC fixed
- Correct negative sign for incoming solar current
- Current multiplied with PWM duty cycle to get average current
- Min/max calculation moved to log.cpp
2019-05-15 11:06:49 +02:00
Martin Jaeger 05ccfb4c65 Missing log.cpp added 2019-05-08 08:58:37 +02:00
Martin Jaeger 7c75548193 DC bus type introduced and unit tests added 2019-05-07 18:56:04 +02:00
Martin Jaeger d9f7103e97 Starting test-driven development (TDD) with Unity
- 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
2019-05-04 11:31:37 +02:00
Martin Jaeger 90666d697b Refactoring of files and function names
- 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
2019-05-03 10:33:49 +02:00
Martin Jaeger ba9baf49c5 Fix error in EEPROM CRC calculation 2019-05-03 08:58:26 +02:00
Martin Jaeger 3fbb6df468 ThingSet version updated and data_objects.cpp adjusted 2019-05-02 10:33:02 +02:00
Martin Jaeger ff53f6ff99 New revisions of PWM and MPPT 10A boards included 2019-05-02 10:27:16 +02:00
Martin Jaeger 2ac2d1c3ad Basic processer-in-the-loop (PIL) test features added 2019-05-02 10:22:51 +02:00
Martin Jaeger 213ebf8c17 Improved load overcurrent and overvoltage diagnosis and protection 2019-04-28 17:29:57 +02:00
Martin Jaeger ca9997ec83 Temperature compensation for charging target voltage added 2019-04-19 15:43:47 +02:00
Martin Jaeger 879d86e59e Comments for correct battery settings in config.h template added 2019-04-18 12:28:18 +02:00
Martin Jaeger eaea5e1af2 Error in high-side (solar) current calculation corrected and logging of Bat and MCU max temperatures added 2019-04-18 12:26:00 +02:00
Martin Jaeger e05fd95e17 Current compensation for load switch thresholds added 2019-04-18 09:23:58 +02:00
Martin Jaeger 666ca02baf Min/max recordings added to serial pub message 2019-04-17 08:18:44 +02:00
Martin Jaeger 73a205f60f Battery and low-side current calculation corrected 2019-04-17 08:16:39 +02:00
Martin Jaeger f02688e6c0 EEPROM fix: Don't store data after start-up 2019-04-03 13:06:22 +02:00
Martin Jaeger 627797ed36 PWM synchronized solar current/voltage measurement implemented 2019-04-01 20:09:27 +02:00
Martin Jaeger 18f7e43999 Flashing instructions for STM32L072 updated 2019-03-31 18:17:48 +02:00
Martin Jaeger 5d78e18005 EmonCMS integration via WiFi updated 2019-03-31 18:14:57 +02:00
Martin Jaeger 4cf8172090 DCDC state info added and charger state naming updated 2019-03-31 13:41:03 +02:00
Martin Jaeger 368ade0a82 External temperature sensor detection added 2019-03-26 15:32:50 +01:00
Martin Jaeger e80e33606b DCDC enable data object (input type) added 2019-03-25 18:16:31 +01:00
Martin Jaeger bb2ab2a9d5 Initialization of some rec data objects improved 2019-03-25 17:50:34 +01:00
Martin Jaeger 3d36e3224c Upgrade to new mbed framework and PlatformIO build system 2019-03-20 11:56:41 +01:00
Martin Jaeger 9510c05932 Data objects + energy calculation updated
- Battery charge/discharge energy is now tracked in addition to solar input and load output energy
- Min/max values of several measurements are stored
- EEPROM data objects list updated
2019-03-19 21:40:59 +01:00
Martin Jaeger 67a9341f74 Doxygen comments added to load and power port files 2019-03-19 10:23:36 +01:00
Martin Jaeger e94fd88a5e Implemented maximum voltage check for DC/DC 2019-03-19 10:11:52 +01:00
Martin Jaeger 6c9ea2ee84 Doxygen location adjusted and mentioned in README.md 2019-03-11 10:44:29 +01:00
Martin Jaeger 50f4378a8d Doxygen settings for Travis CI adjusted 2019-03-10 18:58:03 +01:00
Martin Jaeger 8190e99825 Initial version of PWM charge controller part added 2019-03-10 18:43:00 +01:00
Martin Jaeger e4a20fba85 Battery config updated and started with Doxygen added 2019-03-10 18:34:05 +01:00
Martin Jaeger e9c45702c8 LED timer frequency reduced and charlieplexing fixed to remove flickering 2019-03-10 17:25:23 +01:00
Martin Jaeger 4e0b7f2a12 Restructuring of data types (structs) and files
- dcdc_port_t renamed to power_port_t for future use in PWM charge controllers
- structs.h split into battery.h, log.h and charger.h
- bat_charger.cpp/h split into battery.cpp/h and charger.cpp/h
2019-03-10 17:19:44 +01:00
Martin Jaeger 871c8e46be PCB configuration moved to subdirectory /pcbs 2019-03-10 16:42:44 +01:00
Martin Jaeger 676948c5ad Removed unused unittest scripts 2019-03-10 16:26:59 +01:00
maclow92 ebf098f511 Update firmware.md (#21)
Link update to reach website easily
2019-03-05 15:32:41 +01:00
Martin Jäger 112f36b08b Update master branch with new features from development branch (#20)
* Major changes in DC/DC control and board support + ThingSet library added

* Small platformio.ini fixes
- added libignore for mbed-USBDevice to all STM32F072 builds
- add map file generation. Use text editor or AMAP (http://www.sikorskiy.net/prj/amap/)
to view and learn where the precious flash and ram goes to.
- fixed board define for LS 0.10 board

* Travis fix and more
- Now runs only a selected subset of all configurations (all STM32F072/L073)
- Added a src_filter to the cloudsolar_03 since L073 does not have CAN.
  Maybe there is a better way to do this. Also added libignore for USB
  to this environment.
- Added memory.map to .gitignore

* STML0 support improved + small changes

- STM32L0 now widely supported: PWM signal generation, ADC via DMA and display via I2C are working

- Old files for USB support (only F0) included into repository, as files in original mbed repository don't compile.

- CAN bus support only for F0 (added header defines to allow compilation)

* Cell & Pack Config refactoring: First work on #13.
Reorganized battery init a bit to get a better idea of how to split things.
All known chemistries are now supported with safe values (please check the values).

Added data for NMC (aka "normal" LiIo cells such as most 18650)
A configuration now declares itself to be valid or not after battery_init.

BAT_TYPE_NONE (formerly BAT_TYPE_DEFAULT, which equals 0) will not pass check
and thus is an invalid configuration, as a result an unconfigured
battery_t struct will not be considered valid by accident.

We should not continue to start normal operation if a battery configuration is not valid.
However, this is not yet implemented.

Also slightly changed interface to battery_init, now we pass the number of cells.

Moved the static pub_enabled into main.cpp to get ride of a ton of "unused static variable"
warnings.

* ThingSet moved to separate library

* Removed serious bug in PWM signal generation resulting in PWM with 0% duty cycle

* LED control via PWM for STM32L0 board added

* Gets rid of USB deprecated warnings in application code
This simply disables any warning regarding the use
of deprecated internals in mbed for now.
Since the "new" USBDevice code does not run on F0 or L0, we use old
one which works but generates warnings a lot.
If they ever remove the deprecated interface, we'll know sure enough
since then code will no longer compile.

* More battery init refactoring

In addition to the mandatory arguments cell type, number in series and capacity,
the code now accepts a partially configure battery_t structure (you provide
various voltage levels and charge currents) for Lithium based cells, checks the configuration values for sanity
and tries to adjust if outside valid operational limits. The defaults try
to balance between charging stress and capacity loss.
Charge is by default to about 90% maximum full charge, and discharge stops around
20%-30%.

For lead acid cells all voltage levels and currents are set / calculated based
on the mandatory parameters, no configuration of voltage levels possible.

We may change that, but I don't have enough no knowledge about valid ranges
etc.

I added a high voltage lithium chemistry for cells which have typically
4.35 voltage limit (vs. 4.2 normally).

* Added user configuration for battery and system operation mode
Copy the most relevant template to config.cpp and then compile.
config.cpp is intentionally not part of the git managed source code
since it represents the user specific configuration part
which varies across different firmware builds.

* Turn off MBED Deprecated Warning for Old USB Stack attempt 2
This time cross platform compatible...
And also fix the travis build issue

* Boost mode added and first updates for timer-based DC/DC control

- system_mode now distinguishes between MPPT_BOOST and MPPT_BUCK
- new function system_control() which does all important and fast control
stuff necessary for the DC/DC (will be included into interrupt in the
future)
- small correction in _dcdc_output_control() algorithm after test with e-bike
battery solar charging

* Naming of structs and enums adjusted

* Documentation amended and separate docs folder created.

* UNIT_TEST defines removed

* Timer for DC/DC control implemented, ADC timer updated

* Files restructured / renamed

- config.h is now pcb.h and contains only hardware-specific settings
- anything which communicates to the outside world (display, serial interface, etc)
  is now renamed to more generic "interface" instead of "output" and "communication".
  Use interface_<DEVICE>.cpp for implementations of specific interfaces.

* Updates in user configuration and interfaces

- Battery configuration can now be adjusted in battery_init_user in config.cpp
- New function battery_update_settings implemented to check new battery configuration for plausibility (also needed for later user-configuration via serial interface)
- Templates for GSM and LoRa interfaces created
- Restructuring of main to allow different interface configurations

* Travis CI adjusted to new config.h

* Load output templates added

* ThingSet library updated, interface processing updated, publication functions added

* Load output implementation updated and moved to load.cpp/h

* Energy calculation updated and eTotal changed to uint32_t

* Update firmware.md

* Issue monitor_speed typing mistake

We found a typing issue: "monitor_speed" is mistyped as "monitor_port".

* Major updates of recent months
2019-02-16 09:53:36 +01:00
Martin Jäger d1e5dd32c0 Update README.md 2018-10-18 15:30:44 +02:00
Martin Jäger 7c3b4e046e Merge pull request #10 from hogthrob/refactoring
Refactoring
2018-10-07 16:33:41 +02:00
Hogthrob d8c090dea2 OLED display fix
Charger states now use 4 letter max to fit display.
Minor printf warning fix as well
No functional change.
2018-10-07 11:32:00 +02:00
Hogthrob dd130269bd DataObjects moved into own .cpp file
Some restructuring was done by moving the static const array DataObjects[]
out of the header file. This makes sure to have only a single instance of
it in the resulting binary leading to less memory usage. Before that we had
a individual DataObject[] in each compilation unit data_objects.h was
included in.
For const data this is in most cases not much of a deal beyond wasting memory,
but for non-const static objects potentially a source of confusion during
programming since changing the value in one cpp file would not change
it in other places.
2018-10-07 11:22:32 +02:00
Martin Jäger 5737d87c0e Merge pull request #8 from hogthrob/master
CAN Send Object Name function "fixed"
2018-10-06 20:03:49 +02:00
Hogthrob d22227f86d CAN Send Object Name function "fixed"
- Fixed search algorithm to return -1 if id was not found.
- Added destination id to return message as requested by ThingSet protocol

Function as such is not too useful (it returns only upto 4 characters), but shows that the basic receive/reply works
2018-10-06 19:17:30 +02:00
Martin Jäger b4e74bbc89 Merge pull request #9 from hogthrob/small_fixes
Small fixes / Additions
2018-10-06 18:54:41 +02:00
Hogthrob 6b0c5f3c97 Fixed issue in Adafruit_GFX lib
Well, gcc was right with its warnings (code was incorrect).
2018-10-06 17:51:29 +02:00
Hogthrob 647a0febff Added Travis CI support
Travis CI (https://travis-ci.org/) now builds the firmware for each commit/pull request
(if Travis is enabled for the GitHub repo)
2018-10-06 17:51:28 +02:00
Martin Jäger 339d7dc014 Merge pull request #7 from hogthrob/master
Changed structure to support build specific charger configuration
2018-10-03 12:53:06 +02:00
Hogthrob e2c1137529 Changed structure to support build specific charger configuration without tracked changes in GitHub 2018-10-03 12:07:31 +02:00
Martin Jäger 978cfd34aa Bug in CAN output corrected. 2018-03-13 20:06:57 +01:00
Martin Jäger c26ca16bc7 Hint for flashing firmware added. 2018-03-11 21:17:56 +01:00
Martin Jäger c9a870031c Adjustments for ADC calibration and bugfix in MPPT algorithm 2018-03-11 21:14:26 +01:00
Martin Jäger 4aa51fbe25 DMA for ADC implemented, mbed Ticker removed, files restructured
- DMA partly uses ST HAL API (to be improved in further versions)
- When using mbed ticker to trigger ADC, the program might stall --> use own timer instead
- C++ libraries changed to more simple C-style functions and files (better compatibility with plain C environments)
2018-03-10 14:21:49 +01:00
Martin Jäger efa5ac2bbd moved files for charge controller and half bridge from lib to src 2018-03-05 09:13:50 +01:00
Martin Jäger e10b5165a2 MPPT algorithm improvements and CAN data logging added 2018-03-02 23:59:52 +01:00
Martin Jäger ba9a600f93 12A charger config re-enabled and minor improvements 2017-04-21 13:30:57 +02:00
Martin Jäger ead80a86ad Major updates of software structure
- new classes ChargeController and AnalogValue introduced
- BuckConverter renamed back to HalfBridge
- charging profile settings via struct
2017-04-14 18:04:13 +02:00
Martin Jäger 0908ef3aba Updated state machine and some clean-up 2017-04-07 23:22:22 +02:00
Martin Jäger ba91e0b6c2 MPPT algorithm update, 20A support and OLED display 2017-03-23 17:53:32 +01:00
Martin Jäger 8fa3e64bbe Improved switch-off behavior at sunset 2016-11-30 11:34:02 +01:00
Martin Jäger 17dc3abfb2 Update of state machine and Nokia LCD added 2016-11-19 23:31:32 +01:00
Martin Jäger 663f15a9b2 Initial commit 2016-08-02 14:05:23 +02:00
Martin Jäger 6bf5d8e490 🎉 Added .gitattributes 2016-08-02 14:02:09 +02:00
241 changed files with 16629 additions and 25414 deletions
-4
View File
@@ -1,4 +0,0 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 9734156e256675c45f6ce15c1a57a486
tags: 645f666f9bcd5a90fca523b33c5a78b7
+17
View File
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+12
View File
@@ -0,0 +1,12 @@
.pio
.clang_complete
.gcc-flags.json
.vscode/browse.vc.db*
.vscode
.west
html
memory.map
custom.ini
tools
*.bak
*_bak
+6
View File
@@ -0,0 +1,6 @@
[submodule "lib/thingset"]
path = lib/thingset
url = https://github.com/LibreSolar/thingset-device-library
[submodule "lib/oled-display"]
path = lib/oled-display
url = https://github.com/LibreSolar/oled-display-library
View File
+38
View File
@@ -0,0 +1,38 @@
language: python
# Cache PlatformIO packages using Travis CI container-based infrastructure
sudo: false
cache:
directories:
- "~/.platformio"
env:
- PLATFORMIO_CI_SRC=src
install:
- pip install wheel
- pip install -U platformio
- platformio platform install native
- platformio update
addons:
apt:
packages:
- doxygen
script:
# check for trailing white spaces (comparing with first commit in git log)
- git diff --check `git rev-list HEAD | tail -n 1`..
- platformio run -e mppt_2420_lc -e mppt_1210_hus -e mppt_2420_hc -e pwm_2420_lus
- platformio test -e unit_test
- platformio check -e mppt_1210_hus -e pwm_2420_lus --skip-packages --fail-on-defect high
- doxygen Doxyfile
deploy:
provider: pages
skip_cleanup: true
local_dir: html
github_token: $GH_REPO_TOKEN
on:
repo: LibreSolar/charge-controller-firmware
branch: main
+76
View File
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at info at libre.solar. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
+40
View File
@@ -0,0 +1,40 @@
# Contributing Guide
We welcome every sort of contribution, from bug reports to improvements of the code or new features. If you are not yet
familiar with contributions to open source projects, don't worry. It's not that difficult and most important steps are
explained below.
There are mainly two ways of contribution:
1. If you find a bug or have an idea for a good new feature, just add an **issue** in the GitHub web interface.
2. If you already know how to implement a solution, follow the guide to contribute code below using a **pull-request**.
In case you are not sure about the implementation, raise an issue first to discuss ideas with others.
Please note also our [Code of Conduct](CODE_OF_CONDUCT.md)
## How can I contribute code?
Here is a quick summary how contributions work on GitHub:
1. Fork the repository to your local GitHub account
2. Clone the repository to your local computer using `git clone https://github.com/your-github-username/repository-name.git`
3. Create a new branch where you will later add your changes using `git switch -c branch-name`
4. Update the files to fix the issue or add new features. Please add your copyright notice in a new line if you made significant changes to the file.
5. Use `git add your-changed-files` to add the file contents of the changed files to the so-called staging area (means
they are prepared to be committed)
6. Run `git commit -m "Short message to describe the changes"` to add the staged files to the respository
7. Upload the changes to the remote repository on GitHub using `git push origin branch-name`
8. Submit a pull request via the GitHub web interface and wait for the response of the maintainers.
### Important remarks:
- Better make several small [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) than
a single big one
- Use meaningful commit messages and pull request topics. Tell *what* was changed and not that *something* was changed.
"ADC measurements: Improved performance of temperature sensor reading" is much better than "Updates". You can also
reference an issue with its numer (e.g. #123) in the commit message
- Use the [Libre Solar coding style](https://libre.solar/docs/coding_style/)
## License
All contributions must be licensed under the [Apache License 2.0](LICENSE) as the rest of the repository.
+2536
View File
File diff suppressed because it is too large Load Diff
+176
View File
@@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
+208
View File
@@ -0,0 +1,208 @@
# Libre Solar Charge Controller Firmware
![build badge](https://travis-ci.com/LibreSolar/charge-controller-firmware.svg?branch=main)
This repository contains the firmware for the different Libre Solar Charge Controllers based on [Zephyr RTOS](https://www.zephyrproject.org/).
Coding style is described [here](https://github.com/LibreSolar/coding-style).
## Development and release model
The `main` branch contains the latest release of the firmware plus some cherry-picked bug-fixes. So you can always pull this branch to get a stable and working firmware for your charge controller.
New features are developed in the `develop` branch and merged into `main` after passing tests with multiple boards. The `develop` branch is changed frequently and may even be rebased to fix previous commits. Use this branch only if you want to try out most recent features and be aware that something might be broken.
Releases are generated from `main` after significant changes have been made. The year is used as the major version number. The minor version number starts at zero and is increased for each release in that year.
## Supported devices
The software is configurable to support different charge controller PCBs with STM32F072, low-power STM32L072 or most recent STM32G431 MCUs:
| Board | Default revision | Older revisions |
|-----------------------------------------------------|------------------|-----------------|
| [Libre Solar MPPT 2420 HC](https://github.com/LibreSolar/mppt-2420-hc) | 0.2 | 0.1 |
| [Libre Solar MPPT 2420 LC](https://github.com/LibreSolar/mppt-2420-lc) | 0.10 | |
| [Libre Solar MPPT 1210 HUS](https://github.com/LibreSolar/mppt-1210-hus) | 0.7 | 0.4 |
| [Libre Solar PWM 2420 LUS](https://github.com/LibreSolar/pwm-2420-lus) | 0.3 | 0.2 |
## Building and flashing the firmware
This repository contains git submodules, so you need to clone (download) it by calling:
```
git clone --recursive https://github.com/LibreSolar/charge-controller-firmware
```
Unfortunately, the green GitHub "Clone or download" button does not include submodules. If you cloned the repository already and want to pull the submodules, run `git submodule update --init --recursive`.
### PlatformIO
It is suggested to use Visual Studio Code and PlatformIO for firmware development, as it simplifies compiling and uploading the code a lot:
1. Install Visual Studio Code and [PlatformIO](https://platformio.org/platformio-ide) to build the firmware.
2. Adjust configuration in `zephyr/prj.conf` if necessary.
3. Select the correct board in `platformio.ini` by removing the comment before the board name under `[platformio]` or create a file `custom.ini` with your personal settings. PlatformIO is configured for latest revision of the boards (see table above). For older revisions adjust `platformio.ini` and the `.json` files in `boards` folder manually or use native Zephyr environment.
4. Connect the board via a programmer. See the Libre Solar website for [further project-agnostic instructions](http://libre.solar/docs/flashing).
5. Press the upload button at the bottom left corner in VS Code.
### Native Zephyr environment
You can also use the Zephyr build system directly for advanced configuration with `menuconfig` or if you need more recently added features.
This guide assumes you have already installed the Zephyr SDK and the west tool according to the [Zephyr documentation](https://docs.zephyrproject.org/latest/getting_started/). Also make sure that `west` is at least at version `0.8.0`.
Now after you cloned the repository (see above), go into the root firmware directory and initialize a west workspace:
west init -l zephyr
This command will create a `.west/config` file and set up the repository as specified in `zephyr/west.yml` file. Afterwards the following command pulls the Zephyr source and all necessary modules, which might take a while:
west update
The CMake entry point is in the `zephyr` subfolder, so you need to run `west build` and `west flash` command in that directory.
cd zephyr
Initial board selection (see `boards` subfolder for correct names):
west build -b <board-name>@<revision>
The appended `@<revision>` specifies the board version according to the above table. It can be omitted if only a single board revision is available or if the default (most recent) version should be used. See also [here](https://docs.zephyrproject.org/latest/application/index.html#application-board-version) for more details regarding board revision handling in Zephyr.
Flash with specific debug probe (runner), e.g. J-Link:
west flash -r jlink
User configuration using menuconfig:
west build -t menuconfig
Report of used memory (RAM and flash):
west build -t rom_report
west build -t ram_report
## Firmware customization
This firmware is developed to allow easy customization for individual use-cases. Below options based on the Zephyr devicetree and Kconfig systems try to allow customization without changing any of the files tracked by git, so that a `git pull` does not lead to conflicts with local changes.
### Hardware-specific changes
In Zephyr, all hardware-specific configuration is described in the [devicetree](https://docs.zephyrproject.org/latest/guides/dts/index.html).
The file `boards/arm/board_name/board_name.dts` contains the default devicetree specification (DTS) for a board. It is based on the DTS of the used MCU, which is included from the main Zephyr repository.
In order to overwrite the default devicetree specification, so-called overlays can be used. An overlay file can be specified via the west command line. If it is stored as `board_name.overlay` in the `zephyr` subfolder, it will be recognized automatically when building the firmware for that board (also with PlatformIO).
### Application firmware configuration
For configuration of the application-specific features, Zephyr uses the [Kconfig system](https://docs.zephyrproject.org/latest/guides/kconfig/index.html).
The configuration can be changed using `west build -t menuconfig` command or manually by changing the prj.conf file (see `Kconfig` file for possible options).
Similar to DTS overlays, Kconfig can also be customized per board. Create a folder `zephyr/boards` and a file `board_name.conf` in that folder. The configuration from this file will be merged with the `prj.conf` automatically.
#### Change the battery type
By default, the charge controller is configured for maintainance-free VRLA gel battery (`CONFIG_BAT_TYPE_GEL`). Possible other pre-defined options are `CONFIG_BAT_TYPE_FLOODED`, `CONFIG_BAT_TYPE_AGM`, `CONFIG_BAT_TYPE_LFP`, `CONFIG_BAT_TYPE_NMC` and `CONFIG_BAT_TYPE_NMC_HV`.
The number of cells is automatically selected by Kconfig to get 12V nominal voltage. It can also be manually specified via `CONFIG_BAT_NUM_CELLS`.
To compile the firmware with default settings for 12V LiFePO4 batteries, add the following to `prj.conf` or the board-specific `.conf` file:
```
CONFIG_BAT_TYPE_LFP=y
CONFIG_BAT_NUM_CELLS=4
```
#### Configure serial for ThingSet protocol
By default, the charge controller uses the serial interface in the UEXT connector for the [ThingSet protocol](https://libre.solar/thingset/). This allows to use WiFi modules with ESP32 without any firmware change.
Add the following configuration if you prefer to use the serial of the LS.one port or the additional debug RX/TX pins present on most boards:
```
CONFIG_UEXT_SERIAL_THINGSET=n
```
To disable regular data publication in one-second interval on ThingSet serial at startup add the following configuration:
```
CONFIG_THINGSET_SERIAL_PUB_DEFAULT=n
```
### Custom functions (separate C/C++ files)
If you want experiment with some completely new functions for the charge controller, new files should be stored in a subfolder `src/custom`.
To add the files to the firmware build, create an own CMakeLists.txt in the folder and enable the Kconfig option `CONFIG_CUSTOMIZATION`.
If you think the customization could be relevant for others, please consider sending a pull request. Integrating features into the upstream charge controller firmware guarantees that the feature stays up-to-date and that it will not accidentally break after changes in the original firmware.
## API documentation
The documentation auto-generated by Doxygen can be found [here](https://libre.solar/charge-controller-firmware/).
## Conformance testing
We are using Travis CI to perform several checks for each commit or pull-request. In order to run
the same tests locally (recommended before pushing to the server) use the script `check.sh` or ` check.bat`:
bash check.sh # Linux
cmd check.bat # Windows
### Unit-tests
Core functions of the firmware are covered by unit-tests (located in test directory). Run the tests with the following command:
platformio test -e unit_test
### Static code analysis
PlatformIO integrates cppcheck and clangtidy. The following command is an example to run the checks for MPPT 1210 HUS charge controller code:
platformio check -e mppt_1210_hus
## Additional firmware documentation (docs folder)
- [Charge controller basic concepts](docs/charger-concepts.md)
- [Firmware module overview](docs/module-overview.md)
## Troubleshooting
### Errors with STM32L072 MCU using OpenOCD
The standard OpenOCD settings sometimes fail to flash firmware to this MCU, which is used in the MPPT 1210 HUS and the PWM charge controller.
Try one of these workarounds:
1. Change OpenOCD settings to `adapter_khz 500` in line 70 in `~/.platformio/packages/tool-openocd/scripts/target/stm32l0.cfg`.
2. Use other tools or debug probes such as [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) or [Segger J-Link](https://www.segger.com/products/debug-probes/j-link/).
### Connection failures
If flashing fails like this in PlatformIO:
```
Error: init mode failed (unable to connect to the target)
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked
```
or with ST-Link:
```bash
$ st-flash write .pio/build/mppt-1210-hus-v0.4/firmware.bin 0x08000000
st-flash 1.5.1
2019-06-21T18:13:03 INFO common.c: Loading device parameters....
2019-06-21T18:13:03 WARN common.c: unknown chip id! 0x5fa0004
```
check the connection between the programmer (for example the ST-Link of the Nucleo board) and the charge controller.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

-51
View File
@@ -1,51 +0,0 @@
====================================================
Libre Solar Charge Controller Firmware Documentation
====================================================
This documentation describes the firmware based on `Zephyr RTOS`_ for different Libre Solar MPPT/PWM
Charge Controllers.
The firmware is under ongoing development. Most recent version can be found on
`GitHub <https://github.com/LibreSolar/charge-controller-firmware>`_.
This documentation is licensed under the Creative Commons Attribution-ShareAlike 4.0 International
(CC BY-SA 4.0) License.
.. image:: static/images/cc-by-sa-centered.png
The full license text is available at `<https://creativecommons.org/licenses/by-sa/4.0/>`_.
.. _Zephyr RTOS: https://zephyrproject.org
.. toctree::
:caption: Overview
:hidden:
src/overview/features
src/overview/supported_hardware
src/overview/charger_concepts
.. toctree::
:caption: Development
:hidden:
src/dev/workspace_setup
src/dev/building_flashing
src/dev/customization
src/dev/unit_tests
src/dev/troubleshooting
.. toctree::
:caption: API Reference
:hidden:
src/api/bat_charger
src/api/daq
src/api/data_objects
src/api/dcdc
src/api/device_status
src/api/half_bridge
src/api/load
src/api/power_port
src/api/pwm_switch
src/api/misc
-5
View File
@@ -1,5 +0,0 @@
Battery Charger
===============
.. doxygenfile:: bat_charger.h
:project: app
-5
View File
@@ -1,5 +0,0 @@
Data Acquisition
================
.. doxygenfile:: daq.h
:project: app
-9
View File
@@ -1,9 +0,0 @@
Data Objects
============
The charge controller uses the [ThingSet protocol](https://thingset.github.io/) for communication
with external devices. Internal data that should be exposed via the protocol is defined in the
Data Objects module.
.. doxygenfile:: data_objects.h
:project: app
-5
View File
@@ -1,5 +0,0 @@
DC/DC converter
===============
.. doxygenfile:: dcdc.h
:project: app
-5
View File
@@ -1,5 +0,0 @@
Device Status
=============
.. doxygenfile:: device_status.h
:project: app
-5
View File
@@ -1,5 +0,0 @@
Half Bridge Driver
==================
.. doxygenfile:: half_bridge.h
:project: app
-5
View File
@@ -1,5 +0,0 @@
Load Output
===========
.. doxygenfile:: load.h
:project: app
-32
View File
@@ -1,32 +0,0 @@
Misc
====
Data Storage
------------
.. doxygenfile:: data_storage.h
:project: app
Hardware
--------
.. doxygenfile:: hardware.h
:project: app
Helper
------
.. doxygenfile:: helper.h
:project: app
LEDs
----
.. doxygenfile:: leds.h
:project: app
Setup
-----
.. doxygenfile:: setup.h
:project: app
-5
View File
@@ -1,5 +0,0 @@
DC Bus and Power Port
=====================
.. doxygenfile:: power_port.h
:project: app
-5
View File
@@ -1,5 +0,0 @@
PWM Switch
==========
.. doxygenfile:: pwm_switch.h
:project: app
@@ -1,35 +0,0 @@
Building and Flashing
=====================
As the ``main`` branch may contain unstable code, make sure to select the desired release branch
(see GitHub for a list of releases and branches):
.. code-block:: bash
git switch <your-release>-branch
west update
The ``app`` subfolder contains all application source files and the CMake entry point to build the
firmware, so we go into that directory first.
.. code-block:: bash
cd app
Initial board selection (see ``boards`` subfolder for correct names):
.. code-block:: bash
west build -b <board-name>@<revision>
The appended ``@<revision>`` specifies the board version according to the above table. It can be
omitted if only a single board revision is available or if the default (most recent) version should
be used. See also
`here <https://docs.zephyrproject.org/latest/application/index.html#application-board-version>`_
for more details regarding board revision handling in Zephyr.
Flash with specific debug probe (runner), e.g. J-Link:
.. code-block:: bash
west flash -r jlink
-89
View File
@@ -1,89 +0,0 @@
Customization
=============
This firmware is developed to allow easy customization for individual use-cases. Below options
based on the Zephyr devicetree and Kconfig systems try to allow customization without changing
any of the files tracked by git, so that a `git pull` does not lead to conflicts with local
changes.
Hardware-specific changes
-------------------------
In Zephyr, all hardware-specific configuration is described in the
`Devicetree <https://docs.zephyrproject.org/latest/guides/dts/index.html>`_.
The file ``boards/arm/board_name/board_name.dts`` contains the default devicetree specification
(DTS) for a board. It is based on the DTS of the used MCU, which is included from the main Zephyr
repository.
In order to overwrite the default devicetree specification, so-called overlays can be used. An
overlay file can be specified via the west command line. If it is stored as ``board_name.overlay``
in the ``app`` subfolder, it will be recognized automatically when building the firmware for that
board.
Application firmware configuration
----------------------------------
For configuration of the application-specific features, Zephyr uses the
`Kconfig system <https://docs.zephyrproject.org/latest/guides/kconfig/index.html>`_.
The configuration can be changed using ``west build -t menuconfig`` command or manually by changing
the prj.conf file (see ``Kconfig`` file for possible options).
Similar to DTS overlays, Kconfig can also be customized per board. Create a folder ``app/boards``
and a file ``board_name.conf`` in that folder. The configuration from this file will be merged with
the ``prj.conf`` automatically.
Change the battery type
"""""""""""""""""""""""
By default, the charge controller is configured for maintainance-free VRLA gel battery
(``CONFIG_BAT_TYPE_GEL``). Possible other pre-defined options are ``CONFIG_BAT_TYPE_FLOODED``,
``CONFIG_BAT_TYPE_AGM``, ``CONFIG_BAT_TYPE_LFP``, ``CONFIG_BAT_TYPE_NMC`` and
``CONFIG_BAT_TYPE_NMC_HV``.
The number of cells is automatically selected by Kconfig to get 12V nominal voltage. It can also
be manually specified via ``CONFIG_BAT_NUM_CELLS``.
To compile the firmware with default settings for 12V LiFePO4 batteries, add the following to
``prj.conf`` or the board-specific ``.conf`` file:
.. code-block:: bash
CONFIG_BAT_TYPE_LFP=y
CONFIG_BAT_NUM_CELLS=4
Configure serial for ThingSet protocol
""""""""""""""""""""""""""""""""""""""
By default, the charge controller uses the serial interface in the UEXT connector for the
`ThingSet protocol <https://libre.solar/thingset/>`_. This allows to use WiFi modules with ESP32
without any firmware change.
Add the following configuration if you prefer to use the serial of the additional debug RX/TX pins
present on many boards:
.. code-block:: bash
CONFIG_UEXT_SERIAL_THINGSET=n
To disable regular data publication in one-second interval on ThingSet serial at startup add the
following configuration:
.. code-block:: bash
CONFIG_THINGSET_SERIAL_PUB_DEFAULT=n
Custom functions (separate C/C++ files)
---------------------------------------
If you want experiment with some completely new functions for the charge controller, new files
should be stored in a subfolder ``src/custom``.
To add the files to the firmware build, create an own CMakeLists.txt in the folder and enable the
Kconfig option ``CONFIG_CUSTOMIZATION``.
If you think the customization could be relevant for others, please consider sending a pull request.
Integrating features into the upstream charge controller firmware guarantees that the feature stays
up-to-date and that it will not accidentally break after changes in the original firmware.
-21
View File
@@ -1,21 +0,0 @@
Troubleshoting
==============
This page contains a collection of often encountered issues and solutions.
Errors with STM32L072 MCU using OpenOCD
---------------------------------------
The standard OpenOCD settings sometimes fail to flash firmware to this MCU, which is used in the
MPPT 1210 HUS and the PWM charge controller.
Try one of these workarounds:
1. Change OpenOCD settings to ``adapter_khz 500`` in ``openocd-path/scripts/target/stm32l0.cfg``.
2. Use other tools or debug probes such as `STM32CubeProgrammer`_ or `Segger J-Link`_.
3. Change OpenOCD setting from ``reset_config srst_only`` to ``reset_config srst_open_drain`` or ``reset_config none`` in ``boards/arm/<yourboard>/support/openocd.cfg``.
.. _STM32CubeProgrammer: https://www.st.com/en/development-tools/stm32cubeprog.html
.. _Segger J-Link: https://www.segger.com/products/debug-probes/j-link/
-22
View File
@@ -1,22 +0,0 @@
Unit Tests
==========
Core functions of the firmware are covered by unit-tests (located in ``tests`` directory). Build
and run the tests with the following command:
.. code-block:: bash
cd tests
west build -p -b native_posix -t run
Conformance testing
-------------------
We are using Continuous Integration to perform several checks for each commit or pull-request. In
order to run the same tests locally (recommended before pushing to the server) use the script
``check.sh`` or ``check.bat`` in the ``scripts`` folder:
.. code-block:: bash
./scripts/check.sh # use check.bat on Windows
-52
View File
@@ -1,52 +0,0 @@
Workspace Setup
===============
This guide assumes you have already installed the Zephyr SDK and the ``west`` tool according to the
`Zephyr documentation <https://docs.zephyrproject.org/latest/getting_started/>`_.
Below commands initialize a new workspace and pull all required source files:
.. code-block:: bash
# create a new west workspace and pull the charge controller firmware
west init -m https://github.com/LibreSolar/charge-controller-firmware west-workspace
cd west-workspace/charge-controller-firmware
# pull Zephyr upstream repository and modules (may take a while)
west update
Afterwards, most important folders in your workspace will look like this:
.. code-block:: bash
west-workspace/ # contains .west/config
│
├── charge-controller-firmware/ # application firmware repository
│ ├── app/ # application source files
│ ├── boards/ # board specifications
│ ├── tests/ # unit test source files
│ └── west.yml # main manifest file
│
├── modules/ # modules imported by Zephyr and CC firmware
|
├── tools/ # tools used by Zephyr
│
└── zephyr/ # upstream Zephyr repository
If you already have a west workspace set up (e.g. for other Libre Solar firmware), you can also
re-use it to avoid having many copies of upstream Zephyr and modules:
.. code-block:: bash
# go to your workspace directory
cd your-zephyr-workspace
# pull the charge controller firmware
git clone https://github.com/LibreSolar/charge-controller-firmware
cd charge-controller-firmware
# re-configure and update the workspace
# (to be done each time you switch between applications in same workspace)
west config manifest.path charge-controller-firmware
west update
-25
View File
@@ -1,25 +0,0 @@
Features
========
- Running on `Zephyr RTOS`_
- STM32F0, STM32L0 and STM32G4 series MCUs
- Different battery types supported (lead-acid, Li-ion, LiFePO4)
- Maximum power point tracking (MPPT) algorithm based on Perturb and Observe (P&O)
- PWM solar input (for certain hardware)
- Load output with deep-discharge protection
- Monitoring and configuration using the `ThingSet`_ protocol (mapping to MQTT, CoAP and HTTP
possible)
- Serial interface
- CAN bus
- OLED display support
.. _Zephyr RTOS: https://docs.zephyrproject.org
.. _ThingSet: https://thingset.io
@@ -1,24 +0,0 @@
Supported Hardware
==================
The software is configurable to support different charge controller PCBs with STM32F072, low-power
STM32L072 or most recent STM32G431 MCUs:
+-------------------------------+-----------+---------+-------+
| | | Revisions |
| | +---------+-------+
| Board | MCU | Default | Older |
+===============================+===========+=========+=======+
| Libre Solar `MPPT 2420 HC`_ | STM32G431 | 0.2 | 0.1 |
+-------------------------------+-----------+---------+-------+
| Libre Solar `MPPT 2420 LC`_ | STM32F072 | 0.10 | |
+-------------------------------+-----------+---------+-------+
| Libre Solar `MPPT 1210 HUS`_ | STM32L072 | 0.7 | 0.4 |
+-------------------------------+-----------+---------+-------+
| Libre Solar `PWM 2420 LUS`_ | STM32L072 | 0.3 | 0.2 |
+-------------------------------+-----------+---------+-------+
.. _MPPT 2420 HC: https://github.com/LibreSolar/mppt-2420-hc
.. _MPPT 2420 LC: https://github.com/LibreSolar/mppt-2420-lc
.. _MPPT 1210 HUS: https://github.com/LibreSolar/mppt-1210-hus
.. _PWM 2420 LUS: https://github.com/LibreSolar/pwm-2420-lus
@@ -1,134 +0,0 @@
/*
* _sphinx_javascript_frameworks_compat.js
* ~~~~~~~~~~
*
* Compatability shim for jQuery and underscores.js.
*
* WILL BE REMOVED IN Sphinx 6.0
* xref RemovedInSphinx60Warning
*
*/
/**
* select a different prefix for underscore
*/
$u = _.noConflict();
/**
* small helper function to urldecode strings
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
*/
jQuery.urldecode = function(x) {
if (!x) {
return x
}
return decodeURIComponent(x.replace(/\+/g, ' '));
};
/**
* small helper function to urlencode strings
*/
jQuery.urlencode = encodeURIComponent;
/**
* This function returns the parsed url parameters of the
* current request. Multiple values per key are supported,
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
for (var i = 0; i < parts.length; i++) {
var tmp = parts[i].split('=', 2);
var key = jQuery.urldecode(tmp[0]);
var value = jQuery.urldecode(tmp[1]);
if (key in result)
result[key].push(value);
else
result[key] = [value];
}
return result;
};
/**
* highlight a given string on a jquery object by wrapping it in
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 &&
!jQuery(node.parentNode).hasClass(className) &&
!jQuery(node.parentNode).hasClass("nohighlight")) {
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
var bbox = node.parentElement.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this, addItems);
});
}
}
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};
/*
* backward compatibility for jQuery.browser
* This will be supported until firefox bug is fixed.
*/
if (!jQuery.browser) {
jQuery.uaMatch = function(ua) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
jQuery.browser = {};
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
}
-900
View File
@@ -1,900 +0,0 @@
/*
* basic.css
* ~~~~~~~~~
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
/* -- main layout ----------------------------------------------------------- */
div.clearer {
clear: both;
}
div.section::after {
display: block;
content: '';
clear: left;
}
/* -- relbar ---------------------------------------------------------------- */
div.related {
width: 100%;
font-size: 90%;
}
div.related h3 {
display: none;
}
div.related ul {
margin: 0;
padding: 0 0 0 10px;
list-style: none;
}
div.related li {
display: inline;
}
div.related li.right {
float: right;
margin-right: 5px;
}
/* -- sidebar --------------------------------------------------------------- */
div.sphinxsidebarwrapper {
padding: 10px 5px 0 10px;
}
div.sphinxsidebar {
float: left;
width: 230px;
margin-left: -100%;
font-size: 90%;
word-wrap: break-word;
overflow-wrap : break-word;
}
div.sphinxsidebar ul {
list-style: none;
}
div.sphinxsidebar ul ul,
div.sphinxsidebar ul.want-points {
margin-left: 20px;
list-style: square;
}
div.sphinxsidebar ul ul {
margin-top: 0;
margin-bottom: 0;
}
div.sphinxsidebar form {
margin-top: 10px;
}
div.sphinxsidebar input {
border: 1px solid #98dbcc;
font-family: sans-serif;
font-size: 1em;
}
div.sphinxsidebar #searchbox form.search {
overflow: hidden;
}
div.sphinxsidebar #searchbox input[type="text"] {
float: left;
width: 80%;
padding: 0.25em;
box-sizing: border-box;
}
div.sphinxsidebar #searchbox input[type="submit"] {
float: left;
width: 20%;
border-left: none;
padding: 0.25em;
box-sizing: border-box;
}
img {
border: 0;
max-width: 100%;
}
/* -- search page ----------------------------------------------------------- */
ul.search {
margin: 10px 0 0 20px;
padding: 0;
}
ul.search li {
padding: 5px 0 5px 20px;
background-image: url(file.png);
background-repeat: no-repeat;
background-position: 0 7px;
}
ul.search li a {
font-weight: bold;
}
ul.search li p.context {
color: #888;
margin: 2px 0 0 30px;
text-align: left;
}
ul.keywordmatches li.goodmatch a {
font-weight: bold;
}
/* -- index page ------------------------------------------------------------ */
table.contentstable {
width: 90%;
margin-left: auto;
margin-right: auto;
}
table.contentstable p.biglink {
line-height: 150%;
}
a.biglink {
font-size: 1.3em;
}
span.linkdescr {
font-style: italic;
padding-top: 5px;
font-size: 90%;
}
/* -- general index --------------------------------------------------------- */
table.indextable {
width: 100%;
}
table.indextable td {
text-align: left;
vertical-align: top;
}
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {
height: 10px;
}
table.indextable tr.cap {
margin-top: 10px;
background-color: #f2f2f2;
}
img.toggler {
margin-right: 3px;
margin-top: 3px;
cursor: pointer;
}
div.modindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
div.genindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- general body styles --------------------------------------------------- */
div.body {
min-width: 360px;
max-width: 800px;
}
div.body p, div.body dd, div.body li, div.body blockquote {
-moz-hyphens: auto;
-ms-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
a.headerlink {
visibility: hidden;
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}
div.body p.caption {
text-align: inherit;
}
div.body td {
text-align: left;
}
.first {
margin-top: 0 !important;
}
p.rubric {
margin-top: 30px;
font-weight: bold;
}
img.align-left, figure.align-left, .figure.align-left, object.align-left {
clear: left;
float: left;
margin-right: 1em;
}
img.align-right, figure.align-right, .figure.align-right, object.align-right {
clear: right;
float: right;
margin-left: 1em;
}
img.align-center, figure.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
img.align-default, figure.align-default, .figure.align-default {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-default {
text-align: center;
}
.align-right {
text-align: right;
}
/* -- sidebars -------------------------------------------------------------- */
div.sidebar,
aside.sidebar {
margin: 0 0 0.5em 1em;
border: 1px solid #ddb;
padding: 7px;
background-color: #ffe;
width: 40%;
float: right;
clear: right;
overflow-x: auto;
}
p.sidebar-title {
font-weight: bold;
}
nav.contents,
aside.topic,
div.admonition, div.topic, blockquote {
clear: left;
}
/* -- topics ---------------------------------------------------------------- */
nav.contents,
aside.topic,
div.topic {
border: 1px solid #ccc;
padding: 7px;
margin: 10px 0 10px 0;
}
p.topic-title {
font-size: 1.1em;
font-weight: bold;
margin-top: 10px;
}
/* -- admonitions ----------------------------------------------------------- */
div.admonition {
margin-top: 10px;
margin-bottom: 10px;
padding: 7px;
}
div.admonition dt {
font-weight: bold;
}
p.admonition-title {
margin: 0px 10px 5px 0px;
font-weight: bold;
}
div.body p.centered {
text-align: center;
margin-top: 25px;
}
/* -- content of sidebars/topics/admonitions -------------------------------- */
div.sidebar > :last-child,
aside.sidebar > :last-child,
nav.contents > :last-child,
aside.topic > :last-child,
div.topic > :last-child,
div.admonition > :last-child {
margin-bottom: 0;
}
div.sidebar::after,
aside.sidebar::after,
nav.contents::after,
aside.topic::after,
div.topic::after,
div.admonition::after,
blockquote::after {
display: block;
content: '';
clear: both;
}
/* -- tables ---------------------------------------------------------------- */
table.docutils {
margin-top: 10px;
margin-bottom: 10px;
border: 0;
border-collapse: collapse;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
table.align-default {
margin-left: auto;
margin-right: auto;
}
table caption span.caption-number {
font-style: italic;
}
table caption span.caption-text {
}
table.docutils td, table.docutils th {
padding: 1px 8px 1px 5px;
border-top: 0;
border-left: 0;
border-right: 0;
border-bottom: 1px solid #aaa;
}
th {
text-align: left;
padding-right: 5px;
}
table.citation {
border-left: solid 1px gray;
margin-left: 1px;
}
table.citation td {
border-bottom: none;
}
th > :first-child,
td > :first-child {
margin-top: 0px;
}
th > :last-child,
td > :last-child {
margin-bottom: 0px;
}
/* -- figures --------------------------------------------------------------- */
div.figure, figure {
margin: 0.5em;
padding: 0.5em;
}
div.figure p.caption, figcaption {
padding: 0.3em;
}
div.figure p.caption span.caption-number,
figcaption span.caption-number {
font-style: italic;
}
div.figure p.caption span.caption-text,
figcaption span.caption-text {
}
/* -- field list styles ----------------------------------------------------- */
table.field-list td, table.field-list th {
border: 0 !important;
}
.field-list ul {
margin: 0;
padding-left: 1em;
}
.field-list p {
margin: 0;
}
.field-name {
-moz-hyphens: manual;
-ms-hyphens: manual;
-webkit-hyphens: manual;
hyphens: manual;
}
/* -- hlist styles ---------------------------------------------------------- */
table.hlist {
margin: 1em 0;
}
table.hlist td {
vertical-align: top;
}
/* -- object description styles --------------------------------------------- */
.sig {
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
}
.sig-name, code.descname {
background-color: transparent;
font-weight: bold;
}
.sig-name {
font-size: 1.1em;
}
code.descname {
font-size: 1.2em;
}
.sig-prename, code.descclassname {
background-color: transparent;
}
.optional {
font-size: 1.3em;
}
.sig-paren {
font-size: larger;
}
.sig-param.n {
font-style: italic;
}
/* C++ specific styling */
.sig-inline.c-texpr,
.sig-inline.cpp-texpr {
font-family: unset;
}
.sig.c .k, .sig.c .kt,
.sig.cpp .k, .sig.cpp .kt {
color: #0033B3;
}
.sig.c .m,
.sig.cpp .m {
color: #1750EB;
}
.sig.c .s, .sig.c .sc,
.sig.cpp .s, .sig.cpp .sc {
color: #067D17;
}
/* -- other body styles ----------------------------------------------------- */
ol.arabic {
list-style: decimal;
}
ol.loweralpha {
list-style: lower-alpha;
}
ol.upperalpha {
list-style: upper-alpha;
}
ol.lowerroman {
list-style: lower-roman;
}
ol.upperroman {
list-style: upper-roman;
}
:not(li) > ol > li:first-child > :first-child,
:not(li) > ul > li:first-child > :first-child {
margin-top: 0px;
}
:not(li) > ol > li:last-child > :last-child,
:not(li) > ul > li:last-child > :last-child {
margin-bottom: 0px;
}
ol.simple ol p,
ol.simple ul p,
ul.simple ol p,
ul.simple ul p {
margin-top: 0;
}
ol.simple > li:not(:first-child) > p,
ul.simple > li:not(:first-child) > p {
margin-top: 0;
}
ol.simple p,
ul.simple p {
margin-bottom: 0;
}
aside.footnote > span,
div.citation > span {
float: left;
}
aside.footnote > span:last-of-type,
div.citation > span:last-of-type {
padding-right: 0.5em;
}
aside.footnote > p {
margin-left: 2em;
}
div.citation > p {
margin-left: 4em;
}
aside.footnote > p:last-of-type,
div.citation > p:last-of-type {
margin-bottom: 0em;
}
aside.footnote > p:last-of-type:after,
div.citation > p:last-of-type:after {
content: "";
clear: both;
}
dl.field-list {
display: grid;
grid-template-columns: fit-content(30%) auto;
}
dl.field-list > dt {
font-weight: bold;
word-break: break-word;
padding-left: 0.5em;
padding-right: 5px;
}
dl.field-list > dd {
padding-left: 0.5em;
margin-top: 0em;
margin-left: 0em;
margin-bottom: 0em;
}
dl {
margin-bottom: 15px;
}
dd > :first-child {
margin-top: 0px;
}
dd ul, dd table {
margin-bottom: 10px;
}
dd {
margin-top: 3px;
margin-bottom: 10px;
margin-left: 30px;
}
dl > dd:last-child,
dl > dd:last-child > :last-child {
margin-bottom: 0;
}
dt:target, span.highlighted {
background-color: #fbe54e;
}
rect.highlighted {
fill: #fbe54e;
}
dl.glossary dt {
font-weight: bold;
font-size: 1.1em;
}
.versionmodified {
font-style: italic;
}
.system-message {
background-color: #fda;
padding: 5px;
border: 3px solid red;
}
.footnote:target {
background-color: #ffa;
}
.line-block {
display: block;
margin-top: 1em;
margin-bottom: 1em;
}
.line-block .line-block {
margin-top: 0;
margin-bottom: 0;
margin-left: 1.5em;
}
.guilabel, .menuselection {
font-family: sans-serif;
}
.accelerator {
text-decoration: underline;
}
.classifier {
font-style: oblique;
}
.classifier:before {
font-style: normal;
margin: 0 0.5em;
content: ":";
display: inline-block;
}
abbr, acronym {
border-bottom: dotted 1px;
cursor: help;
}
/* -- code displays --------------------------------------------------------- */
pre {
overflow: auto;
overflow-y: hidden; /* fixes display issues on Chrome browsers */
}
pre, div[class*="highlight-"] {
clear: both;
}
span.pre {
-moz-hyphens: none;
-ms-hyphens: none;
-webkit-hyphens: none;
hyphens: none;
white-space: nowrap;
}
div[class*="highlight-"] {
margin: 1em 0;
}
td.linenos pre {
border: 0;
background-color: transparent;
color: #aaa;
}
table.highlighttable {
display: block;
}
table.highlighttable tbody {
display: block;
}
table.highlighttable tr {
display: flex;
}
table.highlighttable td {
margin: 0;
padding: 0;
}
table.highlighttable td.linenos {
padding-right: 0.5em;
}
table.highlighttable td.code {
flex: 1;
overflow: hidden;
}
.highlight .hll {
display: block;
}
div.highlight pre,
table.highlighttable pre {
margin: 0;
}
div.code-block-caption + div {
margin-top: 0;
}
div.code-block-caption {
margin-top: 1em;
padding: 2px 5px;
font-size: small;
}
div.code-block-caption code {
background-color: transparent;
}
table.highlighttable td.linenos,
span.linenos,
div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
-webkit-user-select: text; /* Safari fallback only */
-webkit-user-select: none; /* Chrome/Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */
}
div.code-block-caption span.caption-number {
padding: 0.1em 0.3em;
font-style: italic;
}
div.code-block-caption span.caption-text {
}
div.literal-block-wrapper {
margin: 1em 0;
}
code.xref, a code {
background-color: transparent;
font-weight: bold;
}
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
background-color: transparent;
}
.viewcode-link {
float: right;
}
.viewcode-back {
float: right;
font-family: sans-serif;
}
div.viewcode-block:target {
margin: -1px -10px;
padding: 0 10px;
}
/* -- math display ---------------------------------------------------------- */
img.math {
vertical-align: middle;
}
div.body div.math p {
text-align: center;
}
span.eqno {
float: right;
}
span.eqno a.headerlink {
position: absolute;
z-index: 1;
}
div.math:hover a.headerlink {
visibility: visible;
}
/* -- printout stylesheet --------------------------------------------------- */
@media print {
div.document,
div.documentwrapper,
div.bodywrapper {
margin: 0 !important;
width: 100%;
}
div.sphinxsidebar,
div.related,
div.footer,
#top-link {
display: none;
}
}
-1
View File
@@ -1 +0,0 @@
.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
-156
View File
@@ -1,156 +0,0 @@
/*
* doctools.js
* ~~~~~~~~~~~
*
* Base JavaScript utilities for all Sphinx HTML documentation.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
"use strict";
const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([
"TEXTAREA",
"INPUT",
"SELECT",
"BUTTON",
]);
const _ready = (callback) => {
if (document.readyState !== "loading") {
callback();
} else {
document.addEventListener("DOMContentLoaded", callback);
}
};
/**
* Small JavaScript module for the documentation.
*/
const Documentation = {
init: () => {
Documentation.initDomainIndexTable();
Documentation.initOnKeyListeners();
},
/**
* i18n support
*/
TRANSLATIONS: {},
PLURAL_EXPR: (n) => (n === 1 ? 0 : 1),
LOCALE: "unknown",
// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext: (string) => {
const translated = Documentation.TRANSLATIONS[string];
switch (typeof translated) {
case "undefined":
return string; // no translation
case "string":
return translated; // translation exists
default:
return translated[0]; // (singular, plural) translation tuple exists
}
},
ngettext: (singular, plural, n) => {
const translated = Documentation.TRANSLATIONS[singular];
if (typeof translated !== "undefined")
return translated[Documentation.PLURAL_EXPR(n)];
return n === 1 ? singular : plural;
},
addTranslations: (catalog) => {
Object.assign(Documentation.TRANSLATIONS, catalog.messages);
Documentation.PLURAL_EXPR = new Function(
"n",
`return (${catalog.plural_expr})`
);
Documentation.LOCALE = catalog.locale;
},
/**
* helper function to focus on search bar
*/
focusSearchBar: () => {
document.querySelectorAll("input[name=q]")[0]?.focus();
},
/**
* Initialise the domain index toggle buttons
*/
initDomainIndexTable: () => {
const toggler = (el) => {
const idNumber = el.id.substr(7);
const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`);
if (el.src.substr(-9) === "minus.png") {
el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`;
toggledRows.forEach((el) => (el.style.display = "none"));
} else {
el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`;
toggledRows.forEach((el) => (el.style.display = ""));
}
};
const togglerElements = document.querySelectorAll("img.toggler");
togglerElements.forEach((el) =>
el.addEventListener("click", (event) => toggler(event.currentTarget))
);
togglerElements.forEach((el) => (el.style.display = ""));
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler);
},
initOnKeyListeners: () => {
// only install a listener if it is really needed
if (
!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS &&
!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS
)
return;
document.addEventListener("keydown", (event) => {
// bail for input elements
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
// bail with special keys
if (event.altKey || event.ctrlKey || event.metaKey) return;
if (!event.shiftKey) {
switch (event.key) {
case "ArrowLeft":
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
const prevLink = document.querySelector('link[rel="prev"]');
if (prevLink && prevLink.href) {
window.location.href = prevLink.href;
event.preventDefault();
}
break;
case "ArrowRight":
if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break;
const nextLink = document.querySelector('link[rel="next"]');
if (nextLink && nextLink.href) {
window.location.href = nextLink.href;
event.preventDefault();
}
break;
}
}
// some keyboard layouts may need Shift to get /
switch (event.key) {
case "/":
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break;
Documentation.focusSearchBar();
event.preventDefault();
}
});
},
};
// quick alias for translations
const _ = Documentation.gettext;
_ready(Documentation.init);
-14
View File
@@ -1,14 +0,0 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
FILE_SUFFIX: '.html',
LINK_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt',
NAVIGATION_WITH_KEYS: false,
SHOW_SEARCH_SUMMARY: true,
ENABLE_SEARCH_SHORTCUTS: true,
};
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

-10881
View File
File diff suppressed because it is too large Load Diff
-2
View File
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}});
-4
View File
@@ -1,4 +0,0 @@
/**
* @preserve HTML5 Shiv 3.7.3-pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return y.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(y,b.frag)}function j(a){a||(a=b);var d=f(a);return!y.shivCSS||p||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),q||i(a,d),a}function k(a){for(var b,c=a.getElementsByTagName("*"),e=c.length,f=RegExp("^(?:"+d().join("|")+")$","i"),g=[];e--;)b=c[e],f.test(b.nodeName)&&g.push(b.applyElement(l(b)));return g}function l(a){for(var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(A+":"+a.nodeName);d--;)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function m(a){for(var b,c=a.split("{"),e=c.length,f=RegExp("(^|[\\s,>+~])("+d().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),g="$1"+A+"\\:$2";e--;)b=c[e]=c[e].split("}"),b[b.length-1]=b[b.length-1].replace(f,g),c[e]=b.join("}");return c.join("{")}function n(a){for(var b=a.length;b--;)a[b].removeNode()}function o(a){function b(){clearTimeout(g._removeSheetTimer),d&&d.removeNode(!0),d=null}var d,e,g=f(a),h=a.namespaces,i=a.parentWindow;return!B||a.printShived?a:("undefined"==typeof h[A]&&h.add(A),i.attachEvent("onbeforeprint",function(){b();for(var f,g,h,i=a.styleSheets,j=[],l=i.length,n=Array(l);l--;)n[l]=i[l];for(;h=n.pop();)if(!h.disabled&&z.test(h.media)){try{f=h.imports,g=f.length}catch(o){g=0}for(l=0;g>l;l++)n.push(f[l]);try{j.push(h.cssText)}catch(o){}}j=m(j.reverse().join("")),e=k(a),d=c(a,j)}),i.attachEvent("onafterprint",function(){n(e),clearTimeout(g._removeSheetTimer),g._removeSheetTimer=setTimeout(b,500)}),a.printShived=!0,a)}var p,q,r="3.7.3",s=a.html5||{},t=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,v="_html5shiv",w=0,x={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",p="hidden"in a,q=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){p=!0,q=!0}}();var y={elements:s.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:r,shivCSS:s.shivCSS!==!1,supportsUnknownElements:q,shivMethods:s.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=y,j(b);var z=/^$|\b(?:all|print)\b/,A="html5shiv",B=!q&&function(){var c=b.documentElement;return!("undefined"==typeof b.namespaces||"undefined"==typeof b.parentWindow||"undefined"==typeof c.applyElement||"undefined"==typeof c.removeNode||"undefined"==typeof a.attachEvent)}();y.type+=" print",y.shivPrint=o,o(b),"object"==typeof module&&module.exports&&(module.exports=y)}("undefined"!=typeof window?window:this,document);
-4
View File
@@ -1,4 +0,0 @@
/**
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3-pre",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
File diff suppressed because one or more lines are too long
-199
View File
@@ -1,199 +0,0 @@
/*
* language_data.js
* ~~~~~~~~~~~~~~~~
*
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
/* Non-minified version is copied as a separate JS file, is available */
/**
* Porter Stemmer
*/
var Stemmer = function() {
var step2list = {
ational: 'ate',
tional: 'tion',
enci: 'ence',
anci: 'ance',
izer: 'ize',
bli: 'ble',
alli: 'al',
entli: 'ent',
eli: 'e',
ousli: 'ous',
ization: 'ize',
ation: 'ate',
ator: 'ate',
alism: 'al',
iveness: 'ive',
fulness: 'ful',
ousness: 'ous',
aliti: 'al',
iviti: 'ive',
biliti: 'ble',
logi: 'log'
};
var step3list = {
icate: 'ic',
ative: '',
alize: 'al',
iciti: 'ic',
ical: 'ic',
ful: '',
ness: ''
};
var c = "[^aeiou]"; // consonant
var v = "[aeiouy]"; // vowel
var C = c + "[^aeiouy]*"; // consonant sequence
var V = v + "[aeiou]*"; // vowel sequence
var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
var s_v = "^(" + C + ")?" + v; // vowel in stem
this.stemWord = function (w) {
var stem;
var suffix;
var firstch;
var origword = w;
if (w.length < 3)
return w;
var re;
var re2;
var re3;
var re4;
firstch = w.substr(0,1);
if (firstch == "y")
w = firstch.toUpperCase() + w.substr(1);
// Step 1a
re = /^(.+?)(ss|i)es$/;
re2 = /^(.+?)([^s])s$/;
if (re.test(w))
w = w.replace(re,"$1$2");
else if (re2.test(w))
w = w.replace(re2,"$1$2");
// Step 1b
re = /^(.+?)eed$/;
re2 = /^(.+?)(ed|ing)$/;
if (re.test(w)) {
var fp = re.exec(w);
re = new RegExp(mgr0);
if (re.test(fp[1])) {
re = /.$/;
w = w.replace(re,"");
}
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1];
re2 = new RegExp(s_v);
if (re2.test(stem)) {
w = stem;
re2 = /(at|bl|iz)$/;
re3 = new RegExp("([^aeiouylsz])\\1$");
re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re2.test(w))
w = w + "e";
else if (re3.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
else if (re4.test(w))
w = w + "e";
}
}
// Step 1c
re = /^(.+?)y$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(s_v);
if (re.test(stem))
w = stem + "i";
}
// Step 2
re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step2list[suffix];
}
// Step 3
re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
suffix = fp[2];
re = new RegExp(mgr0);
if (re.test(stem))
w = stem + step3list[suffix];
}
// Step 4
re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
re2 = /^(.+?)(s|t)(ion)$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
if (re.test(stem))
w = stem;
}
else if (re2.test(w)) {
var fp = re2.exec(w);
stem = fp[1] + fp[2];
re2 = new RegExp(mgr1);
if (re2.test(stem))
w = stem;
}
// Step 5
re = /^(.+?)e$/;
if (re.test(w)) {
var fp = re.exec(w);
stem = fp[1];
re = new RegExp(mgr1);
re2 = new RegExp(meq1);
re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
w = stem;
}
re = /ll$/;
re2 = new RegExp(mgr1);
if (re.test(w) && re2.test(w)) {
re = /.$/;
w = w.replace(re,"");
}
// and turn initial Y back to y
if (firstch == "y")
w = firstch.toLowerCase() + w.substr(1);
return w;
}
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

-75
View File
@@ -1,75 +0,0 @@
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #f8f8f8; }
.highlight .c { color: #3D7B7B; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #9C6500 } /* Comment.Preproc */
.highlight .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
.highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #E40000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #008400 } /* Generic.Inserted */
.highlight .go { color: #717171 } /* Generic.Output */
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #0044DD } /* Generic.Traceback */
.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008000 } /* Keyword.Pseudo */
.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #B00040 } /* Keyword.Type */
.highlight .m { color: #666666 } /* Literal.Number */
.highlight .s { color: #BA2121 } /* Literal.String */
.highlight .na { color: #687822 } /* Name.Attribute */
.highlight .nb { color: #008000 } /* Name.Builtin */
.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.highlight .no { color: #880000 } /* Name.Constant */
.highlight .nd { color: #AA22FF } /* Name.Decorator */
.highlight .ni { color: #717171; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0000FF } /* Name.Function */
.highlight .nl { color: #767600 } /* Name.Label */
.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #19177C } /* Name.Variable */
.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #666666 } /* Literal.Number.Bin */
.highlight .mf { color: #666666 } /* Literal.Number.Float */
.highlight .mh { color: #666666 } /* Literal.Number.Hex */
.highlight .mi { color: #666666 } /* Literal.Number.Integer */
.highlight .mo { color: #666666 } /* Literal.Number.Oct */
.highlight .sa { color: #BA2121 } /* Literal.String.Affix */
.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
.highlight .sc { color: #BA2121 } /* Literal.String.Char */
.highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */
.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
.highlight .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
.highlight .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
.highlight .sx { color: #008000 } /* Literal.String.Other */
.highlight .sr { color: #A45A77 } /* Literal.String.Regex */
.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0000FF } /* Name.Function.Magic */
.highlight .vc { color: #19177C } /* Name.Variable.Class */
.highlight .vg { color: #19177C } /* Name.Variable.Global */
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
.highlight .vm { color: #19177C } /* Name.Variable.Magic */
.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
-566
View File
@@ -1,566 +0,0 @@
/*
* searchtools.js
* ~~~~~~~~~~~~~~~~
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
"use strict";
/**
* Simple result scoring code.
*/
if (typeof Scorer === "undefined") {
var Scorer = {
// Implement the following function to further tweak the score for each result
// The function takes a result array [docname, title, anchor, descr, score, filename]
// and returns the new score.
/*
score: result => {
const [docname, title, anchor, descr, score, filename] = result
return score
},
*/
// query matches the full name of an object
objNameMatch: 11,
// or matches in the last dotted part of the object name
objPartialMatch: 6,
// Additive scores depending on the priority of the object
objPrio: {
0: 15, // used to be importantResults
1: 5, // used to be objectResults
2: -5, // used to be unimportantResults
},
// Used when the priority is not in the mapping.
objPrioDefault: 0,
// query found in title
title: 15,
partialTitle: 7,
// query found in terms
term: 5,
partialTerm: 2,
};
}
const _removeChildren = (element) => {
while (element && element.lastChild) element.removeChild(element.lastChild);
};
/**
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
*/
const _escapeRegExp = (string) =>
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
const _displayItem = (item, searchTerms) => {
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT;
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
const [docName, title, anchor, descr, score, _filename] = item;
let listItem = document.createElement("li");
let requestUrl;
let linkUrl;
if (docBuilder === "dirhtml") {
// dirhtml builder
let dirname = docName + "/";
if (dirname.match(/\/index\/$/))
dirname = dirname.substring(0, dirname.length - 6);
else if (dirname === "index/") dirname = "";
requestUrl = docUrlRoot + dirname;
linkUrl = requestUrl;
} else {
// normal html builders
requestUrl = docUrlRoot + docName + docFileSuffix;
linkUrl = docName + docLinkSuffix;
}
let linkEl = listItem.appendChild(document.createElement("a"));
linkEl.href = linkUrl + anchor;
linkEl.dataset.score = score;
linkEl.innerHTML = title;
if (descr)
listItem.appendChild(document.createElement("span")).innerHTML =
" (" + descr + ")";
else if (showSearchSummary)
fetch(requestUrl)
.then((responseData) => responseData.text())
.then((data) => {
if (data)
listItem.appendChild(
Search.makeSearchSummary(data, searchTerms)
);
});
Search.output.appendChild(listItem);
};
const _finishSearch = (resultCount) => {
Search.stopPulse();
Search.title.innerText = _("Search Results");
if (!resultCount)
Search.status.innerText = Documentation.gettext(
"Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
);
else
Search.status.innerText = _(
`Search finished, found ${resultCount} page(s) matching the search query.`
);
};
const _displayNextItem = (
results,
resultCount,
searchTerms
) => {
// results left, load the summary and display it
// this is intended to be dynamic (don't sub resultsCount)
if (results.length) {
_displayItem(results.pop(), searchTerms);
setTimeout(
() => _displayNextItem(results, resultCount, searchTerms),
5
);
}
// search finished, update title and status message
else _finishSearch(resultCount);
};
/**
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
* custom function per language.
*
* The regular expression works by splitting the string on consecutive characters
* that are not Unicode letters, numbers, underscores, or emoji characters.
* This is the same as ``\W+`` in Python, preserving the surrogate pair area.
*/
if (typeof splitQuery === "undefined") {
var splitQuery = (query) => query
.split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu)
.filter(term => term) // remove remaining empty strings
}
/**
* Search Module
*/
const Search = {
_index: null,
_queued_query: null,
_pulse_status: -1,
htmlToText: (htmlString) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() });
const docContent = htmlElement.querySelector('[role="main"]');
if (docContent !== undefined) return docContent.textContent;
console.warn(
"Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template."
);
return "";
},
init: () => {
const query = new URLSearchParams(window.location.search).get("q");
document
.querySelectorAll('input[name="q"]')
.forEach((el) => (el.value = query));
if (query) Search.performSearch(query);
},
loadIndex: (url) =>
(document.body.appendChild(document.createElement("script")).src = url),
setIndex: (index) => {
Search._index = index;
if (Search._queued_query !== null) {
const query = Search._queued_query;
Search._queued_query = null;
Search.query(query);
}
},
hasIndex: () => Search._index !== null,
deferQuery: (query) => (Search._queued_query = query),
stopPulse: () => (Search._pulse_status = -1),
startPulse: () => {
if (Search._pulse_status >= 0) return;
const pulse = () => {
Search._pulse_status = (Search._pulse_status + 1) % 4;
Search.dots.innerText = ".".repeat(Search._pulse_status);
if (Search._pulse_status >= 0) window.setTimeout(pulse, 500);
};
pulse();
},
/**
* perform a search for something (or wait until index is loaded)
*/
performSearch: (query) => {
// create the required interface elements
const searchText = document.createElement("h2");
searchText.textContent = _("Searching");
const searchSummary = document.createElement("p");
searchSummary.classList.add("search-summary");
searchSummary.innerText = "";
const searchList = document.createElement("ul");
searchList.classList.add("search");
const out = document.getElementById("search-results");
Search.title = out.appendChild(searchText);
Search.dots = Search.title.appendChild(document.createElement("span"));
Search.status = out.appendChild(searchSummary);
Search.output = out.appendChild(searchList);
const searchProgress = document.getElementById("search-progress");
// Some themes don't use the search progress node
if (searchProgress) {
searchProgress.innerText = _("Preparing search...");
}
Search.startPulse();
// index already loaded, the browser was quick!
if (Search.hasIndex()) Search.query(query);
else Search.deferQuery(query);
},
/**
* execute search (requires search index to be loaded)
*/
query: (query) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const titles = Search._index.titles;
const allTitles = Search._index.alltitles;
const indexEntries = Search._index.indexentries;
// stem the search terms and add them to the correct list
const stemmer = new Stemmer();
const searchTerms = new Set();
const excludedTerms = new Set();
const highlightTerms = new Set();
const objectTerms = new Set(splitQuery(query.toLowerCase().trim()));
splitQuery(query.trim()).forEach((queryTerm) => {
const queryTermLower = queryTerm.toLowerCase();
// maybe skip this "word"
// stopwords array is from language_data.js
if (
stopwords.indexOf(queryTermLower) !== -1 ||
queryTerm.match(/^\d+$/)
)
return;
// stem the word
let word = stemmer.stemWord(queryTermLower);
// select the correct list
if (word[0] === "-") excludedTerms.add(word.substr(1));
else {
searchTerms.add(word);
highlightTerms.add(queryTermLower);
}
});
if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js
localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" "))
}
// console.debug("SEARCH: searching for:");
// console.info("required: ", [...searchTerms]);
// console.info("excluded: ", [...excludedTerms]);
// array of [docname, title, anchor, descr, score, filename]
let results = [];
_removeChildren(document.getElementById("search-progress"));
const queryLower = query.toLowerCase();
for (const [title, foundTitles] of Object.entries(allTitles)) {
if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) {
let score = Math.round(100 * queryLower.length / title.length)
results.push([
docNames[file],
titles[file] !== title ? `${titles[file]} > ${title}` : title,
id !== null ? "#" + id : "",
null,
score,
filenames[file],
]);
}
}
}
// search for explicit entries in index directives
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
for (const [file, id] of foundEntries) {
let score = Math.round(100 * queryLower.length / entry.length)
results.push([
docNames[file],
titles[file],
id ? "#" + id : "",
null,
score,
filenames[file],
]);
}
}
}
// lookup as object
objectTerms.forEach((term) =>
results.push(...Search.performObjectSearch(term, objectTerms))
);
// lookup as search terms in fulltext
results.push(...Search.performTermsSearch(searchTerms, excludedTerms));
// let the scorer override scores with a custom scoring function
if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item)));
// now sort the results by score (in opposite order of appearance, since the
// display function below uses pop() to retrieve items) and then
// alphabetically
results.sort((a, b) => {
const leftScore = a[4];
const rightScore = b[4];
if (leftScore === rightScore) {
// same score: sort alphabetically
const leftTitle = a[1].toLowerCase();
const rightTitle = b[1].toLowerCase();
if (leftTitle === rightTitle) return 0;
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
}
return leftScore > rightScore ? 1 : -1;
});
// remove duplicate search results
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
let seen = new Set();
results = results.reverse().reduce((acc, result) => {
let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(',');
if (!seen.has(resultStr)) {
acc.push(result);
seen.add(resultStr);
}
return acc;
}, []);
results = results.reverse();
// for debugging
//Search.lastresults = results.slice(); // a copy
// console.info("search results:", Search.lastresults);
// print the results
_displayNextItem(results, results.length, searchTerms);
},
/**
* search for object names
*/
performObjectSearch: (object, objectTerms) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const objects = Search._index.objects;
const objNames = Search._index.objnames;
const titles = Search._index.titles;
const results = [];
const objectSearchCallback = (prefix, match) => {
const name = match[4]
const fullname = (prefix ? prefix + "." : "") + name;
const fullnameLower = fullname.toLowerCase();
if (fullnameLower.indexOf(object) < 0) return;
let score = 0;
const parts = fullnameLower.split(".");
// check for different match types: exact matches of full name or
// "last name" (i.e. last dotted part)
if (fullnameLower === object || parts.slice(-1)[0] === object)
score += Scorer.objNameMatch;
else if (parts.slice(-1)[0].indexOf(object) > -1)
score += Scorer.objPartialMatch; // matches in last name
const objName = objNames[match[1]][2];
const title = titles[match[0]];
// If more than one term searched for, we require other words to be
// found in the name/title/description
const otherTerms = new Set(objectTerms);
otherTerms.delete(object);
if (otherTerms.size > 0) {
const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase();
if (
[...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0)
)
return;
}
let anchor = match[3];
if (anchor === "") anchor = fullname;
else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname;
const descr = objName + _(", in ") + title;
// add custom score for some objects according to scorer
if (Scorer.objPrio.hasOwnProperty(match[2]))
score += Scorer.objPrio[match[2]];
else score += Scorer.objPrioDefault;
results.push([
docNames[match[0]],
fullname,
"#" + anchor,
descr,
score,
filenames[match[0]],
]);
};
Object.keys(objects).forEach((prefix) =>
objects[prefix].forEach((array) =>
objectSearchCallback(prefix, array)
)
);
return results;
},
/**
* search for full-text terms in the index
*/
performTermsSearch: (searchTerms, excludedTerms) => {
// prepare search
const terms = Search._index.terms;
const titleTerms = Search._index.titleterms;
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const titles = Search._index.titles;
const scoreMap = new Map();
const fileMap = new Map();
// perform the search on the required terms
searchTerms.forEach((word) => {
const files = [];
const arr = [
{ files: terms[word], score: Scorer.term },
{ files: titleTerms[word], score: Scorer.title },
];
// add support for partial matches
if (word.length > 2) {
const escapedWord = _escapeRegExp(word);
Object.keys(terms).forEach((term) => {
if (term.match(escapedWord) && !terms[word])
arr.push({ files: terms[term], score: Scorer.partialTerm });
});
Object.keys(titleTerms).forEach((term) => {
if (term.match(escapedWord) && !titleTerms[word])
arr.push({ files: titleTerms[word], score: Scorer.partialTitle });
});
}
// no match but word was a required one
if (arr.every((record) => record.files === undefined)) return;
// found search word in contents
arr.forEach((record) => {
if (record.files === undefined) return;
let recordFiles = record.files;
if (recordFiles.length === undefined) recordFiles = [recordFiles];
files.push(...recordFiles);
// set score for the word in each file
recordFiles.forEach((file) => {
if (!scoreMap.has(file)) scoreMap.set(file, {});
scoreMap.get(file)[word] = record.score;
});
});
// create the mapping
files.forEach((file) => {
if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1)
fileMap.get(file).push(word);
else fileMap.set(file, [word]);
});
});
// now check if the files don't contain excluded terms
const results = [];
for (const [file, wordList] of fileMap) {
// check if all requirements are matched
// as search terms with length < 3 are discarded
const filteredTermCount = [...searchTerms].filter(
(term) => term.length > 2
).length;
if (
wordList.length !== searchTerms.size &&
wordList.length !== filteredTermCount
)
continue;
// ensure that none of the excluded terms is in the search result
if (
[...excludedTerms].some(
(term) =>
terms[term] === file ||
titleTerms[term] === file ||
(terms[term] || []).includes(file) ||
(titleTerms[term] || []).includes(file)
)
)
break;
// select one (max) score for the file.
const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w]));
// add result to the result list
results.push([
docNames[file],
titles[file],
"",
null,
score,
filenames[file],
]);
}
return results;
},
/**
* helper function to return a node containing the
* search summary for a given text. keywords is a list
* of stemmed words.
*/
makeSearchSummary: (htmlText, keywords) => {
const text = Search.htmlToText(htmlText);
if (text === "") return null;
const textLower = text.toLowerCase();
const actualStartPosition = [...keywords]
.map((k) => textLower.indexOf(k.toLowerCase()))
.filter((i) => i > -1)
.slice(-1)[0];
const startWithContext = Math.max(actualStartPosition - 120, 0);
const top = startWithContext === 0 ? "" : "...";
const tail = startWithContext + 240 < text.length ? "..." : "";
let summary = document.createElement("p");
summary.classList.add("context");
summary.textContent = top + text.substr(startWithContext, 240).trim() + tail;
return summary;
},
};
_ready(Search.init);
-144
View File
@@ -1,144 +0,0 @@
/* Highlighting utilities for Sphinx HTML documentation. */
"use strict";
const SPHINX_HIGHLIGHT_ENABLED = true
/**
* highlight a given string on a node by wrapping it in
* span elements with the given class name.
*/
const _highlight = (node, addItems, text, className) => {
if (node.nodeType === Node.TEXT_NODE) {
const val = node.nodeValue;
const parent = node.parentNode;
const pos = val.toLowerCase().indexOf(text);
if (
pos >= 0 &&
!parent.classList.contains(className) &&
!parent.classList.contains("nohighlight")
) {
let span;
const closestNode = parent.closest("body, svg, foreignObject");
const isInSVG = closestNode && closestNode.matches("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.classList.add(className);
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
parent.insertBefore(
span,
parent.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling
)
);
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
const rect = document.createElementNS(
"http://www.w3.org/2000/svg",
"rect"
);
const bbox = parent.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute("class", className);
addItems.push({ parent: parent, target: rect });
}
}
} else if (node.matches && !node.matches("button, select, textarea")) {
node.childNodes.forEach((el) => _highlight(el, addItems, text, className));
}
};
const _highlightText = (thisNode, text, className) => {
let addItems = [];
_highlight(thisNode, addItems, text, className);
addItems.forEach((obj) =>
obj.parent.insertAdjacentElement("beforebegin", obj.target)
);
};
/**
* Small JavaScript module for the documentation.
*/
const SphinxHighlight = {
/**
* highlight the search words provided in localstorage in the text
*/
highlightSearchWords: () => {
if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight
// get and clear terms from localstorage
const url = new URL(window.location);
const highlight =
localStorage.getItem("sphinx_highlight_terms")
|| url.searchParams.get("highlight")
|| "";
localStorage.removeItem("sphinx_highlight_terms")
url.searchParams.delete("highlight");
window.history.replaceState({}, "", url);
// get individual terms from highlight string
const terms = highlight.toLowerCase().split(/\s+/).filter(x => x);
if (terms.length === 0) return; // nothing to do
// There should never be more than one element matching "div.body"
const divBody = document.querySelectorAll("div.body");
const body = divBody.length ? divBody[0] : document.querySelector("body");
window.setTimeout(() => {
terms.forEach((term) => _highlightText(body, term, "highlighted"));
}, 10);
const searchBox = document.getElementById("searchbox");
if (searchBox === null) return;
searchBox.appendChild(
document
.createRange()
.createContextualFragment(
'<p class="highlight-link">' +
'<a href="javascript:SphinxHighlight.hideSearchWords()">' +
_("Hide Search Matches") +
"</a></p>"
)
);
},
/**
* helper function to hide the search marks again
*/
hideSearchWords: () => {
document
.querySelectorAll("#searchbox .highlight-link")
.forEach((el) => el.remove());
document
.querySelectorAll("span.highlighted")
.forEach((el) => el.classList.remove("highlighted"));
localStorage.removeItem("sphinx_highlight_terms")
},
initEscapeListener: () => {
// only install a listener if it is really needed
if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return;
document.addEventListener("keydown", (event) => {
// bail for input elements
if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return;
// bail with special keys
if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;
if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) {
SphinxHighlight.hideSearchWords();
event.preventDefault();
}
});
},
};
_ready(SphinxHighlight.highlightSearchWords);
_ready(SphinxHighlight.initEscapeListener);
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+21
View File
@@ -0,0 +1,21 @@
# Configuration of supported boards
## Zephyr board definition
The definitions found in `boards/arm/my-board/` folders are used directly by Zephyr.
More detiails can be found in Zephyr
[porting guide](https://docs.zephyrproject.org/latest/guides/porting/board_porting.html) and
[Kconfig description](https://docs.zephyrproject.org/latest/guides/kconfig/setting.html#the-initial-configuration).
- `board.cmake`, `CMakeLists.txt`: CMake definitions for board, normally don't need to be touched.
- `Kconfig.board`: Defines the name of the board as used in DTS config.
- `Kconfig.defconfig`: Configuration of invisible Kconfig symbols, i.e. symbols that should not be adjustable by the user via menuconfig.
- `<BOARD>_defconfig`: Default configuration of the board (can be overwritten by prj.conf)
- `<BOARD>.dts`: Main board device tree specification.
- `<BOARD>.yaml`:
- `pinmux.c`: Defines which pins should be used for peripherals like SPI1, SPI2, SPI3 if selected by the user.
## PlatformIO configuration
PlatformIO needs an additional definition file for each board. It is stored as `boards/my-board.json`
+6
View File
@@ -0,0 +1,6 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
config BOARD_MPPT_1210_HUS
bool "Libre Solar MPPT 1210 HUS"
depends on SOC_STM32L072XX
@@ -0,0 +1,19 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
if BOARD_MPPT_1210_HUS
config BOARD
default "mppt_1210_hus"
config LIBRE_SOLAR_TYPE_ID
default 4
if SPI
config SPI_STM32_INTERRUPT
default y
endif # SPI
endif # BOARD_MPPT_1210_HUS_0V7
+6
View File
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(jlink "--device=STM32L072RZ" "--speed=4000" "--reset-after-load")
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
+191
View File
@@ -0,0 +1,191 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/l0/stm32l072Xz.dtsi>
#include <st/l0/stm32l072r(b-z)tx-pinctrl.dtsi>
/ {
model = "Libre Solar MPPT 1210 HUS";
compatible = "st,stm32l072";
pcb {
compatible = "charge-controller";
type = "MPPT 1210 HUS";
hs-voltage-max = <40>;
ls-voltage-max = <16>;
dcdc-current-max = <10>;
};
chosen {
zephyr,console = &usart1;
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
leds {
compatible = "charlieplexing-leds";
gpios = <&gpiob 13 GPIO_ACTIVE_HIGH>, /* Pin A */
<&gpiob 14 GPIO_ACTIVE_HIGH>, /* Pin B */
<&gpiob 2 GPIO_ACTIVE_HIGH>; /* Pin C */
soc_1 {
states = <1 2 0>; /* LED1 */
};
soc_2 {
states = <0 2 1>; /* LED2 */
};
soc_3 {
states = <1 0 2>; /* LED3 */
};
load {
states = <2 0 1>; /* LED4 */
};
rxtx {
states = <2 1 0>; /* LED5 */
};
};
outputs {
compatible = "outputs";
load {
label = "Load output";
gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
current-max = <10>;
kconfig-flag; /* make node visible in Kconfig */
};
usb-pwr {
label = "USB charging port enable";
gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>;
};
boot0 {
label = "BOOT0 pin trigger";
gpios = <&gpiob 12 GPIO_ACTIVE_HIGH>;
};
};
adc-inputs {
compatible = "adc-inputs";
v-low {
io-channels = <&adc1 0>;
multiplier = <105600>;
divider = <5600>;
};
v-high {
io-channels = <&adc1 1>;
multiplier = <105600>;
divider = <5600>;
enable-gpios = <&gpioc 14 GPIO_ACTIVE_HIGH>;
};
i-load {
io-channels = <&adc1 5>;
// amp gain: 50, resistor: 3 mOhm
multiplier = <1000>;
divider = <150>; // 3*50
};
i-dcdc {
io-channels = <&adc1 6>;
// amp gain: 50, resistor: 3 mOhm
multiplier = <1000>;
divider = <150>; // 3*50
};
temp-bat {
io-channels = <&adc1 7>;
multiplier = <10000>;
divider = <1>;
};
vref-mcu {
io-channels = <&adc1 17>;
multiplier = <1>;
divider = <1>;
};
temp-mcu {
io-channels = <&adc1 18>;
multiplier = <10000>;
divider = <1>;
};
};
aliases {
uart-dbg = &usart1;
uart-uext = &usart2;
spi-uext = &spi1;
i2c-uext = &i2c1;
};
soc {
// not (yet) provided by Zephyr dts, but necessary for dcdc node
timers3: timers@40000400 {
compatible = "st,stm32-timers";
reg = <0x40000400 0x400>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>;
interrupts = <16 0>;
interrupt-names = "global";
status = "disabled";
label = "TIMERS_3";
};
};
};
&usart1 {
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
current-speed = <115200>;
status = "okay";
};
&usart2 {
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
current-speed = <115200>;
status = "okay";
};
&i2c1 {
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
clock-frequency = <I2C_BITRATE_FAST>;
status = "okay";
};
&spi1 {
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
status = "okay";
};
&iwdg {
status = "okay";
};
&timers3 {
status = "okay";
halfbridge {
compatible = "half-bridge";
pinctrl-0 = <&tim3_ch3_pb0 &tim3_ch4_pb1>;
frequency = <50000>;
deadtime = <230>;
};
};
&eeprom {
status = "okay";
};
@@ -0,0 +1,18 @@
identifier: mppt_1210_hus
name: MPPT-1210-HUS
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 20
flash: 192
supported:
- arduino_i2c
- gpio
- i2c
- spi
- watchdog
- adc
- eeprom
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
# empty (using defaults from _defconfig file)
@@ -0,0 +1,78 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
pcb {
version-str = "v0.4";
version-num = <4>;
};
leds {
compatible = "charlieplexing-leds";
gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>, /* GND */
<&gpiob 13 GPIO_ACTIVE_HIGH>, /* SOC_12 */
<&gpiob 2 GPIO_ACTIVE_HIGH>, /* SOC_3 */
<&gpiob 11 GPIO_ACTIVE_HIGH>, /* RXTX */
<&gpiob 10 GPIO_ACTIVE_HIGH>; /* LOAD */
soc_1 {
states = <1 0 0 0 0>;
};
soc_2 {
states = <0 1 0 0 0>;
};
soc_3 {
states = <0 0 1 0 0>;
};
rxtx {
states = <0 0 0 1 0>;
};
load {
states = <0 0 0 0 1>;
};
};
outputs {
compatible = "outputs";
load {
gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
label = "Load enable";
};
usb-pwr {
gpios = <&gpiob 12 GPIO_ACTIVE_HIGH>;
label = "USB charging port enable";
};
/delete-node/ v-solar;
/delete-node/ boot0;
};
adc-inputs {
compatible = "adc-inputs";
i-load {
io-channels = <&adc1 6>;
// amp gain: 50, resistor: 4 mOhm
multiplier = <1000>;
divider = <200>; // 4*50
};
i-dcdc {
io-channels = <&adc1 7>;
// amp gain: 50, resistor: 4 mOhm
multiplier = <1000>;
divider = <200>; // 4*50
};
/delete-node/ temp-bat;
};
};
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
# empty (using defaults from _defconfig file)
@@ -0,0 +1,12 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
pcb {
version-str = "v0.7.1";
version-num = <7>; // minor version .1 includes no HW change
};
};
@@ -0,0 +1,35 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_STM32L0X=y
CONFIG_SOC_STM32L072XX=y
# General Kernel Options
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000
# Serial Drivers
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Pinmux Driver
CONFIG_PINMUX=y
# GPIO Controller
CONFIG_GPIO=y
# Clock configuration
CONFIG_CLOCK_CONTROL=y
# SYSCLK selection
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# PLL configuration
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=4
CONFIG_CLOCK_STM32_PLL_DIVISOR=2
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
CONFIG_EEPROM=y
CONFIG_EEPROM_STM32=y
+6
View File
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
board_check_revision(
FORMAT MAJOR.MINOR.PATCH
DEFAULT_REVISION 0.7.1
)
@@ -0,0 +1,27 @@
# STM32L072 MCU
source [find interface/stlink.cfg]
transport select hla_swd
set WORKAREASIZE 0x2000
source [find target/stm32l0.cfg]
# Add the second flash bank.
set _FLASHNAME $_CHIPNAME.flash1
flash bank $_FLASHNAME stm32lx 0 0 0 0 $_TARGETNAME
# There is only system reset line and JTAG/SWD command can be issued when SRST
reset_config srst_only
$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}
$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}
+6
View File
@@ -0,0 +1,6 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
config BOARD_MPPT_2420_HC
bool "Libre Solar MPPT 2420 HC"
depends on SOC_STM32G431XX
+12
View File
@@ -0,0 +1,12 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
if BOARD_MPPT_2420_HC
config BOARD
default "mppt_2420_hc"
config LIBRE_SOLAR_TYPE_ID
default 8
endif # BOARD_MPPT_2420_HC
+8
View File
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(pyocd "--target=stm32g431rbtx")
board_runner_args(jlink "--device=STM32G431RB" "--speed=4000" "--reset-after-load")
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
+190
View File
@@ -0,0 +1,190 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/g4/stm32g431Xb.dtsi>
#include <st/g4/stm32g431c(6-8-b)tx-pinctrl.dtsi>
/ {
model = "Libre Solar MPPT 2420 HC";
compatible = "st,stm32g431";
pcb {
compatible = "charge-controller";
type = "MPPT 2420 HC";
hs-voltage-max = <90>;
ls-voltage-max = <32>;
dcdc-current-max = <20>;
};
chosen {
zephyr,console = &usart1;
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
/* temporary solution only using green color LED */
leds {
compatible = "charlieplexing-leds";
gpios = <&gpioa 6 GPIO_ACTIVE_LOW>, /* chg red */
<&gpioc 14 GPIO_ACTIVE_LOW>, /* chg green */
<&gpiob 9 GPIO_ACTIVE_LOW>, /* dis red */
<&gpioc 15 GPIO_ACTIVE_LOW>; /* dis green */
pwr {
states = <0 1 0 0>;
};
load {
states = <0 0 0 1>;
};
};
outputs {
compatible = "outputs";
load {
label = "Load output";
gpios = <&gpiob 2 GPIO_ACTIVE_LOW>;
current-max = <20>;
kconfig-flag; /* make node visible in Kconfig */
};
charge_pump {
label = "Charge pump for HS MOSFET drivers";
pwms = <&pwm8 2 200000 PWM_POLARITY_NORMAL>; /* 200 us period = 5 kHz */
};
can_en {
label = "CAN disable / standby";
gpios = <&gpiob 11 GPIO_ACTIVE_LOW>;
};
};
adc-inputs {
compatible = "adc-inputs";
v-low {
io-channels = <&adc1 12>;
multiplier = <105600>;
divider = <5600>;
};
v-high {
io-channels = <&adc1 15>;
multiplier = <102200>;
divider = <2200>;
};
temp-fets {
io-channels = <&adc1 11>;
multiplier = <10000>; // 10k NTC series resistor
divider = <1>;
};
vref-mcu {
io-channels = <&adc1 18>;
multiplier = <1>;
divider = <1>;
};
temp-mcu {
io-channels = <&adc1 16>;
multiplier = <1>;
divider = <1>;
};
i-dcdc {
io-channels = <&adc2 1>;
// amp gain: 25, resistor: 2 mOhm
multiplier = <1000>; // 1000
divider = <50>; // 2*25
};
i-load {
io-channels = <&adc2 2>;
// amp gain: 25, resistor: 2 mOhm
multiplier = <1000>; // 1000
divider = <50>; // 2*25
};
};
aliases {
uart-dbg = &usart1;
uart-uext = &usart2;
spi-uext = &spi1;
i2c-uext = &i2c1;
};
};
&usart1 {
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
current-speed = <115200>;
status = "okay";
};
&usart2 {
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
current-speed = <115200>;
status = "okay";
};
&i2c1 {
pinctrl-0 = <&i2c1_scl_pa15 &i2c1_sda_pb7>;
clock-frequency = <I2C_BITRATE_STANDARD>;
status = "okay";
};
&spi1 {
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
cs-gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
status = "okay";
};
&spi2 {
pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
cs-gpios = <&gpioa 5 GPIO_ACTIVE_LOW>;
status = "okay";
};
&iwdg {
status = "okay";
};
&timers1 {
status = "okay";
halfbridge {
compatible = "half-bridge";
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pc13>;
frequency = <70000>;
deadtime = <300>;
};
};
/* TIM8 (CH2) used for charge pump */
&timers8 {
status = "okay";
pwm8: pwm {
status = "okay";
st,prescaler = <149>; /* reduce counter clock frequency to 1 MHz */
pinctrl-0 = <&tim8_ch2_pb8>;
};
};
&can1 {
pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
bus-speed = <250000>;
bus-speed-data = <250000>;
sjw = <1>;
sjw-data = <1>;
sample-point = <875>;
sample-point-data = <875>;
status = "okay";
};
+18
View File
@@ -0,0 +1,18 @@
identifier: mppt_2420_hc
name: MPPT-2420-HC
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 32
flash: 128
supported:
- nvs
- pwm
- i2c
- gpio
- usb device
- counter
- spi
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_I2C=y
CONFIG_EEPROM=y
CONFIG_EEPROM_AT24=y
@@ -0,0 +1,68 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
pcb {
version-str = "v0.1";
version-num = <1>;
};
/* temporary solution w/o using RGB LED */
leds {
compatible = "charlieplexing-leds";
gpios = <&gpiob 14 GPIO_ACTIVE_LOW>, /* red */
<&gpiob 15 GPIO_ACTIVE_LOW>, /* green */
<&gpiob 9 GPIO_ACTIVE_LOW>; /* blue */
pwr {
states = <1 0 0>;
};
load {
states = <0 1 0>;
};
rxtx {
states = <0 0 1>;
};
};
};
&i2c1 {
eeprom@50 {
// Microchip 24AA32A
compatible = "atmel,at24";
reg = <0x50>;
label = "EEPROM_0";
size = <32768>;
pagesize = <32>;
address-width = <16>;
/*
* timeout of 5 ms as suggested in datasheet seems too optimistic
* (several write errors occured during testing)
*/
timeout = <7>;
};
};
&spi1 {
pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
cs-gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
status = "okay";
};
&timers1 {
halfbridge {
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
};
};
&spi2 {
status = "disabled";
/delete-node/ pinctrl-0;
/delete-node/ cs-gpios;
};
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_LOG_LEVEL_WRN=y
#CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_SFDP_RUNTIME=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NVS=y
CONFIG_NVS_LOG_LEVEL_WRN=y
@@ -0,0 +1,81 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
pcb {
version-str = "v0.2";
version-num = <2>;
};
chosen {
zephyr,code-partition = &slot0_partition;
};
};
&spi2 {
w25q80dv: w25q80dv@0 {
compatible = "jedec,spi-nor";
label = "W25Q80DV";
reg = <0>;
spi-max-frequency = <4000000>;
size = <0x800000>; /* bits */
has-dpd;
t-enter-dpd = <4000>;
t-exit-dpd = <25000>;
jedec-id = [ef 40 14];
};
};
/*
* Below partition layout allows to use MCUboot if CONFIG_BOOTLOADER_MCUBOOT is enabled. Otherwise,
* the code will just use the entire available flash of the MCU.
*/
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* bootloader slot: 32 KiB */
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x8000>;
read-only;
};
/* application image slot: 96 KiB */
slot0_partition: partition@8000 {
label = "image-0";
reg = <0x00008000 0x18000>;
};
};
};
&w25q80dv {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* backup slot: 96 KiB */
slot1_partition: partition@0 {
label = "image-1";
reg = <0x00000000 0x18000>;
};
/* swap slot: 96 KiB */
scratch_partition: partition@18000 {
label = "image-scratch";
reg = <0x00018000 0x00018000>;
};
/* remaining 832 KiB of SPI flash used as storage */
storage_partition: partition@30000 {
label = "storage";
reg = <0x00030000 0x000D0000>;
};
};
};
@@ -0,0 +1,67 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_STM32G4X=y
CONFIG_SOC_STM32G431XX=y
# 170MHz system clock only in 'boost power' mode. RM0440, section
# 5.1.5 states that the R1MODE bit must be cleared before system can
# be 170MHz. This requires an update to the stm32 clock control
# driver, so default to 150MHz until then.
# CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=170000000
# 150MHz system clock in 'normal power' mode
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=150000000
# enable uart driver
CONFIG_SERIAL=y
# enable pinmux
CONFIG_PINMUX=y
# enable GPIO
CONFIG_GPIO=y
# clock configuration
CONFIG_CLOCK_CONTROL=y
# Use PLLCLK for SYSCLK
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# Use HSI (16MHz) to feed into PLL
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=4
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=7
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=2
CONFIG_CLOCK_STM32_PLL_R_DIVISOR=2
# Produce 150MHz clock at PLLCLK output
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=75
# Comment out above and uncomment below for 170MHz. Note that you
# must have configured the mcu for boost power mode.
# CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=85
# Produce Max (150MHz or 170MHz) HCLK
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
# Produce Max (150MHz or 170MHz) APB1 clocks and APB2 clocks
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
CONFIG_CLOCK_STM32_APB2_PRESCALER=1
# Console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Enable MPU
CONFIG_ARM_MPU=y
CONFIG_PWM=y
CONFIG_CAN=y
CONFIG_THINGSET_CAN=y
CONFIG_ISOTP=y
CONFIG_ISOTP_RX_BUF_COUNT=2
CONFIG_ISOTP_RX_BUF_SIZE=100
CONFIG_ISOTP_RX_SF_FF_BUF_COUNT=2
+3
View File
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
board_check_revision(FORMAT MAJOR.MINOR.PATCH)
+6
View File
@@ -0,0 +1,6 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
config BOARD_MPPT_2420_HPX
bool "Libre Solar MPPT 2420 HPX"
depends on SOC_STM32G431XX
@@ -0,0 +1,19 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
if BOARD_MPPT_2420_HPX
config BOARD
default "mppt_2420_hpx"
config LIBRE_SOLAR_TYPE_ID
default 7
if SPI
config SPI_STM32_INTERRUPT
default y
endif # SPI
endif # BOARD_MPPT_2420_HPX
+7
View File
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(pyocd "--target=stm32g431rbtx")
board_runner_args(jlink "--device=STM32G431RB" "--speed=4000" "--reset-after-load")
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

Some files were not shown because too many files have changed in this diff Show More