1
0
mirror of https://github.com/sjlongland/cluster-powerctl.git synced 2025-09-13 12:03:14 +10:00
cluster-powerctl/setpoints.h.dist

98 lines
2.5 KiB
C

/*
* 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 (1000)
/*!
* How long before we change LED states? Milliseconds.
*/
#define T_LED_MS (150)
/*
* Temperature ranges and fan PWM settings
*/
#define TEMP_MIN (270 << 6) /*!< ~20°C, approx ADC reading */
#define TEMP_MAX (300 << 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, milliseconds */
#define T_FAN_MS (15000)
/*
* 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 --- */
/*!
* Critically high battery voltage. Exceeding this voltage could damage
* the battery or the equipment downstream of it.
*/
#define V_CH_MV (11800)
/*!
* 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 (15500)
/*!
* Low battery voltage. If the voltage dips to or below this level, we
* should turn the charger on.
*/
#define V_L_MV (12000)
/*!
* Critically low battery voltage. If we reach this level, we need to
* urgently turn the charger on and need to be ready to switch sources
* in a hurry if the chosen source isn't charging.
*/
#define V_CL_MV (11800)
/* --- Timeouts --- */
/*!
* High frequency polling period in milliseconds.
*/
#define T_HF_MS (15000)
/*!
* Low frequency polling period in milliseconds.
*/
#define T_LF_MS (5000)
#endif