ToyKeeper / anduril

Anduril 2 Flashlight Firmware and FSM UI Toolkit
GNU General Public License v3.0
199 stars 48 forks source link

Police Strobe no output when main channel has lowest output saved #62

Closed duncanyoyo1 closed 3 months ago

duncanyoyo1 commented 3 months ago

I can't get the police strobe blink mode to function correctly. It seems like there might be a glitch in the mode memory.

Using the latest trunk

If the light is set to moonlight ( 1/150 ) for the main channel, switching to the police strobe results in no output. 1H doesn't do anything in this mode.

Turning the light off, back on to main channel and setting it above 1/150, then going back to the strobe there's output as expected.

Seems like it's just an issue with the lowest mode.

I have this issue with the TS10-rgbaux, TS11 and TS25.

I thought I was doing something wrong for a few hours till I figured out it was the output setting that was causing the issue.

The firmware that shipped with my TS10 didn't have this issue, though I am not certain what version it was. I would have to flash it back and check it. The TS11 and TS25 both shipped with firmware versions that didn't have the police strobe.

Seems very strange as the police strobe doesn't seem to even have a brightness setting. So I have no idea why it being on moonlight for the main channel would result in no output on the aux.

SiteRelEnby commented 3 months ago

At the moment level 1 for aux channels is off. See https://github.com/ToyKeeper/anduril/pull/47

duncanyoyo1 commented 3 months ago

Ah well that checks out then. Thank you.

Still seems like a bug as I thought the brightness wasn't an option for police strobe ( e.g. shouldn't it always be aux high? )

Trying to use that PRs changes I get a compiler error. I also tried to do the same thing myself ( though slightly different, not with the bitwise operations ) and am hitting the same error. I likely am just not familiar enough with the project, missing an include somewhere or something silly. Or it's probably just out of date with the main branch, but I'm not sure what all changed or where to start or look. Any help is always greatly appreciated.

In file included from hw/wurkkos/ts25/hwdef.c:7:0,
                 from ui/anduril/anduril.c:88:
./fsm/chan-rgbaux.c:6:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
 void set_level_auxred(uint8_t level) {
 ^
aslotnick commented 3 months ago

Police strobe uses the current memorized level, so that matches my expectation with the problem of level 1 for chan-aux and chan-rgb-aux resulting in "off" rather than "aux low".

https://github.com/ToyKeeper/anduril/blob/trunk/ui/anduril/strobe-modes.c#L240

inline void police_color_strobe_iter() {
    // one iteration of main loop()
    uint8_t del = 66;
    // TODO: make police strobe brightness configurable
    uint8_t bright = memorized_level;

I do think #47 would fix this issue. I probably should have opened an issue alongside my PR for clarity as well!

I'm unsure about the compiler error, but I do know that my version was able to compile within github using the workflow Toykeeper setup but in my own repository. If you go to the "checks" section of https://github.com/aslotnick/anduril/pull/1/checks you can download the resulting artifact (direct link] in case you care to try it out. I've rebased from the latest version of trunk.

EDIT: I just confirmed this will fix the issue on ts10-rgb. I flashed the linked compliled version, set manual memory to level 1 using 10C, then activated police strobe mode which resulted in the use of low aux for both red and blue channels. Then when setting mode memory to a higher level, police strobe works as expected with high aux for both channels.

ToyKeeper commented 3 months ago

Fixed by 5a69f495bf773d825468ab8ce74b79b3d3de0dc5.

Police strobe uses the same adjustable brightness method as beacon mode, because on some lights (dual channel lights), police strobe is on main LEDs instead of aux LEDs. But it could definitely use a built-in brightness adjustment, and perhaps disable the variable brightness entirely when configured for aux LED channels.