0

FunHouse Slider input 12 not working
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

FunHouse Slider input 12 not working

by steveputz on Fri May 14, 2021 12:10 pm

Using the pre-installed test program, I cannot get the FunHouse Slider #12 touch pad to indicate.
Everything else I've tested seems to work.

Has anyone else seen this problem?
What should I do next? Should I request a replacement board?

I have not yet tried programming the FunHouse to check the raw sensor value from that input.

funhouse-slider12.jpg
funhouse-slider12.jpg (96.8 KiB) Viewed 323 times

steveputz
 
Posts: 5
Joined: Fri Jan 02, 2015 10:49 pm

Re: FunHouse Slider input 12 not working

by mikeysklar on Fri May 14, 2021 1:03 pm

Depending on which example code the unit ships with (I actually don't know what is on your device) it might not be using all the captouch sliders. In our funhouse_simpletest.py we do not initialize the Cap 9 - Cap 13 sensors, but Cap 6 - 8 are being used.

https://raw.githubusercontent.com/adafr ... pletest.py

Screen Shot 2021-05-14 at 10.00.10 AM.png
Screen Shot 2021-05-14 at 10.00.10 AM.png (400.37 KiB) Viewed 316 times


Code: Select all | TOGGLE FULL SIZE
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import board
from digitalio import DigitalInOut, Direction, Pull
from adafruit_funhouse import FunHouse

funhouse = FunHouse(
    default_bg=0x0F0F00,
    scale=2,
)

funhouse.peripherals.set_dotstars(0x800000, 0x808000, 0x008000, 0x000080, 0x800080)

# sensor setup
sensors = []
for p in (board.A0, board.A1, board.A2):
    sensor = DigitalInOut(p)
    sensor.direction = Direction.INPUT
    sensor.pull = Pull.DOWN
    sensors.append(sensor)


def set_label_color(conditional, index, on_color):
    if conditional:
        funhouse.set_text_color(on_color, index)
    else:
        funhouse.set_text_color(0x606060, index)


# Create the labels
funhouse.display.show(None)
slider_label = funhouse.add_text(
    text="Slider:", text_position=(50, 30), text_color=0x606060
)
capright_label = funhouse.add_text(
    text="Touch", text_position=(85, 10), text_color=0x606060
)
pir_label = funhouse.add_text(text="PIR", text_position=(60, 10), text_color=0x606060)
capleft_label = funhouse.add_text(
    text="Touch", text_position=(25, 10), text_color=0x606060
)
onoff_label = funhouse.add_text(text="OFF", text_position=(10, 25), text_color=0x606060)
up_label = funhouse.add_text(text="UP", text_position=(10, 10), text_color=0x606060)
sel_label = funhouse.add_text(text="SEL", text_position=(10, 60), text_color=0x606060)
down_label = funhouse.add_text(
    text="DOWN", text_position=(10, 100), text_color=0x606060
)
jst1_label = funhouse.add_text(
    text="SENSOR 1", text_position=(40, 80), text_color=0x606060
)
jst2_label = funhouse.add_text(
    text="SENSOR 2", text_position=(40, 95), text_color=0x606060
)
jst3_label = funhouse.add_text(
    text="SENSOR 3", text_position=(40, 110), text_color=0x606060
)
temp_label = funhouse.add_text(
    text="Temp:", text_position=(50, 45), text_color=0xFF00FF
)
pres_label = funhouse.add_text(
    text="Pres:", text_position=(50, 60), text_color=0xFF00FF
)
funhouse.display.show(funhouse.splash)

while True:
    funhouse.set_text("Temp %0.1F" % funhouse.peripherals.temperature, temp_label)
    funhouse.set_text("Pres %d" % funhouse.peripherals.pressure, pres_label)

    print(funhouse.peripherals.temperature, funhouse.peripherals.relative_humidity)
    set_label_color(funhouse.peripherals.captouch6, onoff_label, 0x00FF00)
    set_label_color(funhouse.peripherals.captouch7, capleft_label, 0x00FF00)
    set_label_color(funhouse.peripherals.captouch8, capright_label, 0x00FF00)

    slider = funhouse.peripherals.slider
    if slider is not None:
        funhouse.peripherals.dotstars.brightness = slider
        funhouse.set_text("Slider: %1.1f" % slider, slider_label)
    set_label_color(slider is not None, slider_label, 0xFFFF00)

    set_label_color(funhouse.peripherals.button_up, up_label, 0xFF0000)
    set_label_color(funhouse.peripherals.button_sel, sel_label, 0xFFFF00)
    set_label_color(funhouse.peripherals.button_down, down_label, 0x00FF00)

    set_label_color(funhouse.peripherals.pir_sensor, pir_label, 0xFF0000)
    set_label_color(sensors[0].value, jst1_label, 0xFFFFFF)
    set_label_color(sensors[1].value, jst2_label, 0xFFFFFF)
    set_label_color(sensors[2].value, jst3_label, 0xFFFFFF)

mikeysklar
 
Posts: 4508
Joined: Mon Aug 01, 2016 8:10 pm

Re: FunHouse Slider input 12 not working

by e28eta on Fri May 14, 2021 3:23 pm

I *have* seen all of the sliders illuminate on mine, but my #13 is very hard to trigger. I’m wondering if its a software or hardware problem, but haven’t dug into it yet.

e28eta
 
Posts: 1
Joined: Thu Mar 28, 2019 2:01 am

Re: FunHouse Slider input 12 not working

by adafruit2 on Sat May 15, 2021 2:41 pm

its not that it isnt working, its that the capacitive touch detection code isnt very tuned on that demo - its very rough! you can check the serial console for the raw value itself

adafruit2
Site Admin
 
Posts: 20032
Joined: Fri Mar 11, 2005 7:36 pm

Re: FunHouse Slider input 12 not working

by steveputz on Sun May 16, 2021 5:58 pm

Ok, I now see that the problem is in the adafruit_funhouse/peripherals.py library helper (as of the 4/21/2021 version), not in the hardware.

Printing the raw touchio values on my FunHouse gives values aroud 8900 to 12000 with no touch:

_ctp: 6:( 8909 F) 7:( 9936 F) 8:(10972 F) 13:(11327 F) 12:(11151 F) 11:(10712 F) 10:(11937 F) 9:(11473 F)

and values over 20000 when a pad is touched:

_ctp: 6:( 9153 F) 7:( 9922 F) 8:(10955 F) 13:(31287 T) 12:(24324 T) 11:(10784 F) 10:(12043 F) 9:(11606 F)

Setting all the touch sensor thresholds to 20000 helps, except the code for the slider method
compares the raw values to a hard-coded 15000 and ignores the threshold settings.

I believe the slider method would work better with these changes to the Peripherals class:
https://github.com/adafruit/Adafruit_CircuitPython_FunHouse/blob/main/adafruit_funhouse/peripherals.py

in __init__(self) -- set the thresholds:
Code: Select all | TOGGLE FULL SIZE
        for tp in self._ctp:
            tp.threshold = 20000

and in slider(self) -- use value instead of raw_value:
Code: Select all | TOGGLE FULL SIZE
    def slider(self):
        """
        Return the slider position value in the range of 0.0-1.0 or None if not touched
        """
        val = 0
        cap_map = b"\x01\x03\x02\x05\x04\x0c\x08\x18\x10"
        for cap in range(5):
            touched = self._ctp[cap + 3].value
            if touched:
                val += 1 << (cap)
        for i, pos in enumerate(tuple(cap_map)):
            if val == pos:
                print(i, len(cap_map) - 1)
                return round(i / (len(cap_map) - 1), 1)
        return None

steveputz
 
Posts: 5
Joined: Fri Jan 02, 2015 10:49 pm

Re: FunHouse Slider input 12 not working

by MakerMelissa on Mon May 17, 2021 11:59 am

Thanks for the suggestions. I just updated the FunHouse library.

MakerMelissa
 
Posts: 254
Joined: Wed Jun 05, 2013 2:10 am

Re: FunHouse Slider input 12 not working

by RufusVS2020 on Thu May 20, 2021 11:45 pm

I got my Funhouse a couple days ago, and everything seems to be working EXCEPT the slider.
Occasionally 10 will light up, glitchy, go out without moving my finger, and show up at different
positions on the slider bar. It sounds like the changes described here are not in the built in code
and reloading from library should fix that. Is that right? Other pieces seem to work: PIR, Captouch,
up/down/sel buttons, speaker, leds, reset, etc. Haven't testing stemma or wifi yet. Boot mode works.
So I guess the first step is reloading the funhouse firmware.

RufusVS2020
 
Posts: 14
Joined: Thu Nov 19, 2020 6:31 pm

Re: FunHouse Slider input 12 not working

by adafruit2 on Fri May 21, 2021 10:58 am

yah the touchpad almost certainly works, but the initial test firmware doesnt do a great job of verifying it. try circuitpython

adafruit2
Site Admin
 
Posts: 20032
Joined: Fri Mar 11, 2005 7:36 pm

Re: FunHouse Slider input 12 not working

by RufusVS2020 on Sat May 22, 2021 10:53 pm

On another thread I indicate that I did, in fact, load CircuitPython, and its FunHouse test program. There is still a "dead zone" at .3-.4 in the slider, so it's much better than the shipped demo software, but still an issue.

RufusVS2020
 
Posts: 14
Joined: Thu Nov 19, 2020 6:31 pm

Re: FunHouse Slider input 12 not working

by RufusVS2020 on Sun May 23, 2021 10:43 pm

Found the "dead zone problem":

In the slider method in peripherals.py, there is a line:
Code: Select all | TOGGLE FULL SIZE
        cap_map = b"\x01\x03\x02\x05\x04\x0c\x08\x18\x10"

Which needs to be changed to:
Code: Select all | TOGGLE FULL SIZE
        cap_map = b"\x01\x03\x02\x06\x04\x0c\x08\x18\x10"


(change 0x05 to 0x06)

The code is designed to track when you are pressing a single contact or two adjacent contacts. If you take the binary of
the values, you should have a single bit or two adjacent bits. The binary for 0x05 is 0b00101 which clearly does not have
the required adjacent bits. 0x06 is 0b00110 which is the correct pattern. So when your finger makes contact to those two points, there was no pattern to match, so the function returned None, instead of a scaled value.

Works as expected now.

How do I submit a bug fix here?

RufusVS2020
 
Posts: 14
Joined: Thu Nov 19, 2020 6:31 pm

Re: FunHouse Slider input 12 not working

by mikeysklar on Mon May 24, 2021 2:18 pm

@RufusVS2020,

Thank you for so much for digging in and narrowing it down to this one cap_map address.

You can do a PR (pull request) through github if you are familiar with that process. Otherwise I would recommend opening an issue with the two code lines you provided. Melissa is also on this forum thread, but it still might be best to get an issue so this is not lost.

https://github.com/adafruit/Adafruit_Ci ... _FunHouse/

https://github.com/adafruit/Adafruit_Ci ... use/issues

mikeysklar
 
Posts: 4508
Joined: Mon Aug 01, 2016 8:10 pm

Re: FunHouse Slider input 12 not working

by MakerMelissa on Mon May 24, 2021 2:33 pm

Thank you. A PR was submitted by a community member and merged in.

MakerMelissa
 
Posts: 254
Joined: Wed Jun 05, 2013 2:10 am

Please be positive and constructive with your questions and comments.