FunHouse Slider input 12 not working

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
steveputz
 
Posts: 22
Joined: Fri Jan 02, 2015 10:49 pm

FunHouse Slider input 12 not working

Post by steveputz »

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 606 times

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: FunHouse Slider input 12 not working

Post by mikeysklar »

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 599 times

Code: Select all

# 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)

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

Re: FunHouse Slider input 12 not working

Post by e28eta »

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.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: FunHouse Slider input 12 not working

Post by adafruit2 »

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

User avatar
steveputz
 
Posts: 22
Joined: Fri Jan 02, 2015 10:49 pm

Re: FunHouse Slider input 12 not working

Post by steveputz »

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_Ci ... pherals.py

in __init__(self) -- set the thresholds:

Code: Select all

        for tp in self._ctp:
            tp.threshold = 20000
and in slider(self) -- use value instead of raw_value:

Code: Select all

    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

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: FunHouse Slider input 12 not working

Post by MakerMelissa »

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

User avatar
RufusVS2020
 
Posts: 63
Joined: Thu Nov 19, 2020 6:31 pm

Re: FunHouse Slider input 12 not working

Post by RufusVS2020 »

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.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: FunHouse Slider input 12 not working

Post by adafruit2 »

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

User avatar
RufusVS2020
 
Posts: 63
Joined: Thu Nov 19, 2020 6:31 pm

Re: FunHouse Slider input 12 not working

Post by RufusVS2020 »

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.

User avatar
RufusVS2020
 
Posts: 63
Joined: Thu Nov 19, 2020 6:31 pm

Re: FunHouse Slider input 12 not working

Post by RufusVS2020 »

Found the "dead zone problem":

In the slider method in peripherals.py, there is a line:

Code: Select all

        cap_map = b"\x01\x03\x02\x05\x04\x0c\x08\x18\x10"
Which needs to be changed to:

Code: Select all

        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?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: FunHouse Slider input 12 not working

Post by mikeysklar »

@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

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: FunHouse Slider input 12 not working

Post by MakerMelissa »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “AdaBox! Show us what you made!”