-static uint16_t ambient_zones[] = {
- 0x10, 0x18, 0x20, 0x40, 0x100, 0x400, 0x1000, 0x4000, 0xffff
+/* My photodiode reads 0x00C5 .. 0x033B */
+typedef struct {
+ uint16_t lo, hi;
+} ambient_zone_t;
+
+/*
+ * 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[] = {
+ { 0x0000, 0xa400 }, // dark
+ { 0xa000, 0xc000 },
+ { 0xbe00, 0xc800 },
+ { 0xc600, 0xffff }