#ifndef CONFIG_H #define CONFIG_H /* Thresholds for charging control */ /* Battery regulation corridor width (in mV). */ #define U_BAT_REGULATION_CORRIDOR 100 /* Initial charge battery voltage threshold (in mV). */ #define U_BAT_INITIAL_FULL 28600 // stop charging if battery voltage reaches this threshold /* Cancel initial charge voltage hold below this battery voltage (in mV). */ #define U_BAT_INITIAL_HOLD_CANCEL 28000 /* Transition to floating voltage levels after this time (in ms). */ #define INITIAL_CHARGE_HOLD_TIME 3600000 /* Duration of the transistion from initial charging to float (in ms). */ #define INITIAL_TO_FLOAT_TRANSITION_TIME 600000 /* Float charge battery voltage threshold (in mV). */ #define U_BAT_FLOAT_FULL 27600 // stop charging if battery voltage reaches this threshold /* Minimum voltage difference to U_bat that the solar panels must produce * before charging is resumed after it was switched off (in mV). */ #define SLEEP_SOLAR_EXCESS_VOLTAGE 1000 /* Minimum charge current required before charging is stopped to save power at * the charge pump (in mA). */ #define SLEEP_SOLAR_CURRENT 1 /* Delay between state change and sleep state check (in ms). */ #define SLEEP_STATE_DELAY 100 /* Delay between charging switch state change and sleep state check(in ms). */ #define SLEEP_SWITCH_DELAY 1000 /* Maximum allowed microcontroller temperature (in units of 0.1 °C). If this * temperature is exceeded, charging is stopped. The load is kept on. Do not * set this too high as the heat has to propagate from the power MOSFETs. */ #define INTERNAL_TEMPERATURE_LIMIT 500 /* Resume operation below this temperature (in units of 0.1 °C). */ #define INTERNAL_TEMPERATURE_RECOVERY 450 /* Thresholds for load control */ /* Voltage above which the load is turned on (in mV). */ #define U_BAT_LOAD_ON 27000 /* Voltage below which the load is turned off (in mV). */ #define U_BAT_LOAD_OFF 24000 /* Current at which the overload protection triggers (in mA). */ #define LOAD_CURRENT_LIMIT_MA 10000 /* Inrush tolerance time (in ms). Overload protection is not enforced for this * time after load power-on. */ #define LOAD_CURRENT_INRUSH_TIME 10 /* Minimum voltage that the charge pump must produce above U_bat before any * power FET is switched on (in mV). */ #define MIN_CHARGE_PUMP_EXCESS_VOLTAGE 10000 /* The minimum time the load must be off before it can be switched on again (in ms). */ #define LOAD_ON_DELAY 10000 /* Measurement Averaging: * Alpha is specified in units of 1/1000. 1000 means that only the latest * value is relevant, 0 means that the measurement has no influence. The latter * is useless. * * The formula to calculate the next averaged value avg from a measurement meas is: * avg[k] = meas * (alpha/1000) + avg[k-1] * (1 - alpha/1000) * * For overload protection (battery voltage, load current), the latest values * are always used. * */ /* Averaging factor for load current. */ #define AVG_ALPHA_I_SOLAR 10 #define AVG_ALPHA_I_LOAD 10 #define AVG_ALPHA_U_BAT 100 #define AVG_ALPHA_U_SW 100 #define AVG_ALPHA_U_SOLAR 100 #define AVG_ALPHA_TEMP 10 /* Generic configuration */ /* Time (in ms) to stay active in idle state before entering deep sleep. */ #define DEEPSLEEP_DELAY 1000 /* Deep sleep duration (in seconds). */ #define DEEPSLEEP_DURATION 10 #endif // CONFIG_H