aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-08-24 02:55:14 -0600
committerSelene ToyKeeper2017-08-24 02:55:14 -0600
commit5f20a52bfa35903ece415486423ccc020200ac8c (patch)
treee65d903a17984cd27a70a5001e1f7374ab599beb /spaghetti-monster
parentMade ramping UI able to toggle between smooth and discrete ramping with 4 cli... (diff)
downloadanduril-5f20a52bfa35903ece415486423ccc020200ac8c.tar.gz
anduril-5f20a52bfa35903ece415486423ccc020200ac8c.tar.bz2
anduril-5f20a52bfa35903ece415486423ccc020200ac8c.zip
Set default brightness to max 7135 level.
Made thermal regulation adjust proportional to how far above/below the target range the light is. Replaced turn-on blinks with single shorter/dimmer blip.
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/ramping-ui.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/spaghetti-monster/ramping-ui.c b/spaghetti-monster/ramping-ui.c
index bd5a016..c85804d 100644
--- a/spaghetti-monster/ramping-ui.c
+++ b/spaghetti-monster/ramping-ui.c
@@ -19,7 +19,7 @@
#define FSM_EMISAR_D4_LAYOUT
#define USE_LVP
-//#define USE_THERMAL_REGULATION
+#define USE_THERMAL_REGULATION
#define DEFAULT_THERM_CEIL 32
#define USE_DEBUG_BLINK
#define USE_DELAY_MS
@@ -34,7 +34,7 @@ uint8_t steady_state(EventPtr event, uint16_t arg);
uint8_t party_strobe_state(EventPtr event, uint16_t arg);
// brightness control
-uint8_t memorized_level = 1;
+uint8_t memorized_level = MAX_1x7135;
// smooth vs discrete ramping
uint8_t ramp_step_size = 1;
@@ -189,18 +189,23 @@ uint8_t steady_state(EventPtr event, uint16_t arg) {
return 0;
}
#ifdef USE_THERMAL_REGULATION
- // FIXME: make thermal regulation work with ramping
- // overheating: drop by 1 level
+ // TODO: test this on a real light
+ // overheating: drop by an amount proportional to how far we are above the ceiling
else if (event == EV_temperature_high) {
- if (actual_level > 1) {
- set_level(actual_level - 1);
+ if (actual_level > MAX_LEVEL/4) {
+ uint8_t stepdown = actual_level - arg;
+ if (stepdown < MAX_LEVEL/4) stepdown = MAX_LEVEL/4;
+ set_level(stepdown);
}
return 0;
}
- // underheating: increase by 1 level if we're lower than the target
+ // underheating: increase slowly if we're lower than the target
+ // (proportional to how low we are)
else if (event == EV_temperature_low) {
if (actual_level < target_level) {
- set_level(actual_level + 1);
+ uint8_t stepup = actual_level + (arg>>1);
+ if (stepup > target_level) stepup = target_level;
+ set_level(stepup);
}
return 0;
}
@@ -268,7 +273,9 @@ void low_voltage() {
}
void setup() {
- debug_blink(2);
+ set_level(RAMP_SIZE/8);
+ delay_4ms(3);
+ set_level(0);
push_state(off_state, 0);
}
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.