* Note: these have to be sorted, starting with 0, ending with 0xFFFF
* and having small overlaps in order to provide a bit of hysteresis.
*/
-static ambient_zone_t ambient_zones[] = {
+static ambient_zone_t ambient_zones[N_AMBIENT_ZONES] = {
{ 0x0000 , 0x0270<<AMBIENT_VAL_SHIFT }, // dark
{ 0x0260<<AMBIENT_VAL_SHIFT, 0x02e0<<AMBIENT_VAL_SHIFT }, // evening
{ 0x02d0<<AMBIENT_VAL_SHIFT, 0x0306<<AMBIENT_VAL_SHIFT }, // dawn
{ 0x0300<<AMBIENT_VAL_SHIFT, 0xffff }, // day
};
-#define N_AMBIENT_ZONES (sizeof(ambient_zones)/sizeof(ambient_zones[0]))
void init_ambient()
{
if (ambient_max < byte_val)
ambient_max = byte_val;
+
+ // user_param ambient zone override
+ if ((byte_val = get_user_param(0)) > 0)
+ ambient_zone = byte_val - 1;
+
if (old_zone != ambient_zone) {
#if 0
log_byte(0xab);
* mode.
*/
static unsigned char user_params[N_USER_PARAMS] = { 0, 0, 0 };
-static unsigned char user_params_max[N_USER_PARAMS] = { 3, 2, 2 };
+static unsigned char user_params_max[N_USER_PARAMS] = {
+ N_AMBIENT_ZONES+1, 2, 2
+};
static unsigned char user_params_state = 0;
/*
/* ambient.c */
#define AMBIENT_ADC_SHIFT 0 /* 1 measurement per callback */
+#define N_AMBIENT_ZONES 4
void init_ambient();
void susp_ambient();
void ambient_log_min_max();