# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2019 Martin Jäger (Libre Solar)

#
# Invisible (board-specific) Kconfig symbols
#

config HAS_LOAD_OUTPUT
	bool
	help
	  PCB has a load output.

config HAS_USB_PWR_OUTPUT
	bool
	help
	  PCB has a USB power output.

config CONTROL_FREQUENCY
	int
	default 10
	help
	  Main control function frequency (Hz)

	  Frequencies higher than 10 Hz caused issues with MPPT control during lab test with
	  PV simulator. Might be different with actual solar panel.


#
# Visible (user-configurable) Kconfig symbols
#

choice
    prompt "High-voltage terminal"
    depends on $(dt_compat_enabled,dcdc)
    help
      Select the device connected to the high-voltage
      side terminal of the DC/DC converter.

    config HV_TERMINAL_SOLAR
        bool "Solar panel"

    config HV_TERMINAL_NANOGRID
        bool "DC nanogrid"

    config HV_TERMINAL_GENERATOR
        bool "DC generator, e.g. wind turbine"

    config HV_TERMINAL_BATTERY
        bool "Battery, e.g. electric bicycle"
endchoice


choice
    prompt "Low-voltage terminal"
    help
      Select the device connected to the low-voltage side
      of the charge controller (usually battery terminal).

    config LV_TERMINAL_BATTERY
        depends on !HV_TERMINAL_BATTERY
        bool "Battery 12V/24V"

    config LV_TERMINAL_SOLAR
        depends on HV_TERMINAL_BATTERY || HV_TERMINAL_NANOGRID
        bool "Solar panel"
endchoice


choice
    prompt "PWM terminal"
    depends on $(dt_compat_enabled,pwm-switch)
    help
      Select the device connected to the PWM switch (currently
      only solar panel possible)

    config PWM_TERMINAL_SOLAR
        depends on LV_TERMINAL_BATTERY && !HV_TERMINAL_SOLAR
        bool "Solar panel"
endchoice


menu "Battery configuration"

choice
    prompt "Default battery cell type"
    default BAT_DEFAULT_TYPE_GEL
    help
      Select the type of the single cells inside the battery
      to determine voltage set points. Total voltage set points
      are multiplied with the selected number of cells.

    config BAT_DEFAULT_TYPE_FLOODED
        bool "Flooded (wet) lead-acid"

    config BAT_DEFAULT_TYPE_GEL
        bool "VRLA gel, maintainance-free"

    config BAT_DEFAULT_TYPE_AGM
        bool "AGM, maintainance-free"

    config BAT_DEFAULT_TYPE_LFP
        bool "LiFePO4 Li-ion, 3.3V nominal"

    config BAT_DEFAULT_TYPE_NMC
        bool "NMC/Graphite Li-ion, 3.7V nominal, 4.2V max"

    config BAT_DEFAULT_TYPE_NMC_HV
        bool "NMC/Graphite High Voltage Li-ion, 3.7V nominal, 4.35 max"

endchoice

config BAT_DEFAULT_NUM_CELLS
	int "Default number of battery cells"
	default 6
	range 3 16
	help
      Typical choices:
      - 6 for 12V lead-acid battery
      - 4 for 12V LiFePO4 battery
      - 3 for 12V NMC Li-ion battery

      Remarks:
      - If you choose settings for 12V system, 24V systems
	    (2 batteries in series) are recognized automatically
      - Make sure the voltage of the used charge controller
        is not exceeded.

config BAT_DEFAULT_CAPACITY_AH
    int "Default battery capacity in Ah"
    range 10 200
    default 50

endmenu


menu "Extensions and interfaces"

config EXT_OLED_DISPLAY
    bool "OLED display at UEXT"

config EXT_OLED_BRIGHTNESS
    depends on EXT_OLED_DISPLAY
    int "OLED display brightness"
    range 1 255
    default 1

config EXT_THINGSET_SERIAL
    bool "ThingSet serial interface"

config EXT_THINGSET_SERIAL_RX_BUF_SIZE
    depends on EXT_THINGSET_SERIAL
    int "ThingSet serial RX buffer size"
    range 64 2048
    default 512

config EXT_THINGSET_SERIAL_TX_BUF_SIZE
    depends on EXT_THINGSET_SERIAL
    int "ThingSet serial TX buffer size"
    range 256 2048
    default 1024

config EXT_THINGSET_CAN
    depends on CAN
    bool "ThingSet CAN interface"

config DEVICE_ID
    int "Initial device ID for communication interfaces"
    default 0

endmenu
