Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
105 lines (88 sloc) 2.69 KB
/*
* vim: set filetype=c tw=72:
*/
#ifndef _SETPOINTS_H
#define _SETPOINTS_H
/*!
* Personal Cloud power controller firmware
* (C) 2016 Stuart Longland
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*!
* How long between ADC readings? Milliseconds.
*/
#define T_ADC_MS (250)
/*
* Temperature ranges and fan PWM settings
*/
#define TEMP_MIN (270 << 6) /*!< ~20°C, approx ADC reading */
#define TEMP_MAX (350 << 6) /*!< ~30°C, approx ADC reading */
#define FAN_PWM_MIN (88) /*!< Minimum PWM value */
#define FAN_PWM_MAX (255) /*!< Maximum PWM value */
/*! Fan kick-start timeout, seconds */
#define T_FAN_S (15)
/*
* ADC Voltage divider settings
*/
#define VDIV_R1 (1500ULL) /*!< R1 = 1.5kOhm */
#define VDIV_R2 (100ULL) /*!< R2 = 100 Ohm */
/*
* ADC settings
*/
#define ADC_REF (1100ULL) /*!< AREF = 1.1mV */
#define ADC_MAX (65535ULL) /*!< ADLAR = 1 */
/* --- Thresholds --- */
/*!
* High battery voltage. If we reach this voltage and the charger
* stops, just switch to discharge mode, consider the job done.
*/
#define V_H_MV (14400)
/*!
* Low battery voltage. If the voltage dips to or below this level, we
* should turn the charger on if it remains below this level for T_LOW_S
* seconds.
*/
#define V_L_MV (12750)
/*!
* Critical Low battery voltage. If the voltage dips to or below this
* level, we should turn the charger on *immediately*, ignore all timeouts.
*/
#define V_CL_MV (12200)
/*!
* Solar minimum voltage. If the solar is below this threshold, we
* consider it too low to reliably charge the system.
*/
#define V_SOL_MIN_MV (4000)
/* --- Timeouts --- */
/*!
* How long do we remain in the charge state?
*/
#define T_CHARGE_S (900)
/*!
* How long do we remain on the mains charger after reaching V_H_MV?
*/
#define T_FLOAT_S (900)
/*!
* How long do we remain on the solar charger after dropping below V_L_MV?
* (If we drop below V_CL_MV, go straight to mains charger regardless of
* timer.)
*/
#define T_LOW_S (3600)
/*!
* LED blink interval in milliseconds.
*/
#define T_LED_MS (250)
#endif