Skip to content

Commit

Permalink
Fixed touch rendering to avoid flicker at boot
Browse files Browse the repository at this point in the history
  • Loading branch information
connornishijima committed May 8, 2024
1 parent 42e996f commit 3b420a2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions data/remote.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<!--<div id="mode_bin"></div>-->

<div id="footer">
<span onclick="show_page('page_calibration', 'audio calibration');" class="buzz">
<img id="right_header_item" src="svg/microphone.svg" class="header_icon tint_accent"/>
<span onclick="show_page('page_presets', 'presets');" class="buzz" style="opacity:0.0;">
<img id="right_header_item" src="svg/wand.svg" class="header_icon tint_accent"/>
</span>

<span onclick="show_page('page_modes', 'light modes');" style="margin-bottom: 30px;">
Expand Down
4 changes: 3 additions & 1 deletion extras/CHANGELOG_1.1 → extras/CHANGELOG_1.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@

- Needle UI closes itself automatically after inactivity if no close command arrives

- Reduced web-app cache length from one year to 15 minutes (oops!)
- Reduced web-app cache length from one year to 15 minutes (oops!)

- Touch is now calculated using moving averages, no longer needing manual calibration
4 changes: 2 additions & 2 deletions src/standby.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void run_standby(){

if(standby_brightness > 0.0001){
standby_brightness *= 0.9975;
lpf_drag = 1.0;
lpf_drag = 0.999;

draw_dot(leds, SLEEP_1, dot_color, dot_pos, sqrt(dot_brightness));
draw_dot(leds, SLEEP_2, dot_color, 1.0-dot_pos, sqrt(dot_brightness));
Expand All @@ -36,5 +36,5 @@ void toggle_standby(){
standby_brightness = 1.0;
standby_breath = 0.0;

lpf_drag = 1.0;
lpf_drag = 0.999;
}
12 changes: 11 additions & 1 deletion src/touch.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,19 @@ void read_touch(){
touch_readings[t] = touch_readings[t] * 0.9 + raw_touch_value * 0.1; // Smooth the input
}

if(t_now_ms < 5000){
for(uint8_t t = 0; t < 3; t++){
for(uint8_t i = 0; i < 50; i++){
touch_pins[t].touch_history[i] = touch_readings[t];
}
}
}

if (t_now_ms - last_touch_read_time >= 100) {
for(uint8_t t = 0; t < 3; t++){
touch_pins[t].touch_history[touch_history_index] = touch_readings[t];
if(touch_pins[t].touch_active == false){
touch_pins[t].touch_history[touch_history_index] = touch_readings[t];
}
}

last_touch_read_time = t_now_ms;
Expand Down

0 comments on commit 3b420a2

Please sign in to comment.