• Reader9@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    Good question, just wanted to point out your link

    [https://bazaar.launchpad.net/~toykeeper/flashlight-firmware/multi-channel/view/head:/ToyKeeper/spaghetti-monster/anduril/ramp-mode.c#L423]()

    markdown is broken but copy-pasting the url works.

      • Reader9@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 year ago

        I don’t own a multi-channel, but I did see something that looks interesting in the code (not familiar with the codebase and haven’t worked with C much):

        Could be a red herring but the function channel_has_args looks kind of like it might be doing the same work as if(!arg) for single-channel. Again this could be totally wrong but IF that were the case, then I’d expect that adding to the if statement could potentially help catch this? Like

        if (! arg) || (! channel_has_args(cfg.channel_mode) .

        Also in following the code style the actual statement would also need to include an IFDEF for multi-channel-config but maybe not necessary for you test locally?

        • Protiron@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          Also in following the code style the actual statement would also need to include an IFDEF for multi-channel-config but maybe not necessary for you test locally?

          So Mementary Turbo 3H work for you? If you don’t own multi channel, MT should be 3H from ON. I think l423 be identical for simple or multi channel.

          I can’t find where arg should be equals to 0… steady_state always call with arg <> 0

          • Reader9@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            Sorry for the extraneous information about the ifdef. The important part was whether adding this extra check would fix the bug in the same way as deleting the original line did.

            I can’t find where arg should be equals to 0… steady_state always call with arg <> 0

            From what I could assume in the comments, this refers to the very first state in that steady-state (“first frame”) right when you have done 4H. Then it sets the current level to the appropriate turbo (set_level_and_therm_target).

            Your bug would be that it never set the level to turbo because it never executed set_level_and_therm_target because ! arg evaluates to false.

            Your bug fix was to delete the check, but that means that every instant it will keep trying to set the level to turbo instead of just setting it during the first frame and then maintaining the steady-state.

            My potential fix was to add something so that the statement if (! arg) || (! channel_has_args(cfg.channel_mode) would evaluate to true during the first frame so it can then call set_level_and_therm_target exactly once.

            @[email protected] (if you have a moment) does this seem close to the mark?

            • Protiron@lemmy.worldOP
              link
              fedilink
              English
              arrow-up
              2
              ·
              1 year ago

              | (! channel_has_args(cfg.channel_mode)

              I test that asap. I already try to comment it and it’s work fine :

              //if (! arg) {  // first frame only, to allow thermal regulation to work
                  uint8_t tl = style_2c ? 150 : turbo_level;
                  set_level_and_therm_target(tl);
              //}
              

              But I am surprised that the functionality appears in the diagram and that no one remarks that it does not work (3H without Multi channel or 4H with) https://lemmy.world/post/1038159

              • containerfan@lemmy.world
                link
                fedilink
                English
                arrow-up
                1
                ·
                1 year ago

                It appears in the diagram because it works. Just tested it again on my dual-channel D4V2, and it works like a charm.

            • Reader9@programming.dev
              link
              fedilink
              English
              arrow-up
              1
              ·
              1 year ago

              On reflection i think this is incorrect. arg seems to represent the output level as of when the event was triggered.