Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LedSet(Led::kTpu, false) is not working #113

Open
LanceBao0313 opened this issue Apr 20, 2024 · 1 comment
Open

LedSet(Led::kTpu, false) is not working #113

LanceBao0313 opened this issue Apr 20, 2024 · 1 comment

Comments

@LanceBao0313
Copy link

LanceBao0313 commented Apr 20, 2024

Description

Tried to turn off the white TPU led when running the detect_faces example, but it doesn't work:

bool result = LedSet(Led::kTpu, false);
printf("tpu led off: %d\r\n", result);

Output:
tpu led off: 1

But the led is still on

Click to expand!

Issue Type

Support

Operating System

Mac OS

Coral Device

Dev Board Micro

Other Devices

No response

Programming Language

No response

Relevant Log Output

No response

@dylan-leslie
Copy link

@LanceBao0313 not sure if you managed to fix this or not. However, a fix that worked for me was changing the LedSetBrightness function which LedSet calls.

Replace the following code in LedSetBrightness found in led.cc:

if (enable) {
    PwmEnable({pin_a_config});
} else {
    PwmDisable({pin_a_config});
}

With:

PwmEnable({pin_a_config});

This keeps the LED on but now you can set a duty cycle of 0 (brightness of 0).

Prior, the enable can only be true for brightness values greater than kLedFullyOff (which is 0). Removing the conditional will call PwmEnable({pin_a_config}) no matter what brightness value is given.

For some reason PwmDisable fails to set stop the PWM timer for the Tpu LED. At the moment I'm not sure why, but the above code should fix your issue. Does feel a bit 'hacky' though.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants