Coder Social home page Coder Social logo

Comments (4)

wilba avatar wilba commented on July 30, 2024

I didn't think it worth using RAM on this, my RGB code already had separate state for layouts (like split backspace etc.) prior to the layout option stuff added to VIA. As such, maybe store state in the RGB config which acts as the cache, and then read the layout options on startup/mode change and push that into the RGB config state. If you want to patch in a "no eeprom" getter into via.c then that'll work too.

from keyboards.

drashna avatar drashna commented on July 30, 2024

Yeah, but that's your rgb code. Which I have no intention of implementing. Additionally, there are reasons other than just RGB for wanting to read that information. Being able to do so without having to read from eeprom every time would be nice.

So, aside from reading from the EEPROM constantly, there is no way then, without modifying core code then. Especially since the raw hid callbacks don't send the data to the kb level functions unless it's unrecognized. if that at least passed on the info, it would be a vast improvement, just in general.

But for now, looks like I'm sticking with this:

__attribute__((weak)) void rgb_matrix_indicators_user(void) {
#    ifdef VIA_ENABLE
    static bool     layout_2u = false;
    static uint16_t timer = 0;
    if (timer_elapsed(timer) > 500) {
        timer     = timer_read();
        layout_2u = (bool)via_get_layout_options();
    }
    if (layout_2u) {
        rgb_matrix_set_color(5, 0, 0, 0);
        rgb_matrix_set_color(7, 0, 0, 0);
    } else {
        rgb_matrix_set_color(6, 0, 0, 0);
    }
#    else
    rgb_matrix_set_color(5, 0, 0, 0);
    rgb_matrix_set_color(7, 0, 0, 0);
#    endif
}

from keyboards.

wilba avatar wilba commented on July 30, 2024

This is what I was suggesting - store state locally, cache the layout options state, or make a change to via.c and add a "no eeprom" getter. I can add one in the next round of changes if you don't want to do it.

from keyboards.

drashna avatar drashna commented on July 30, 2024

Well, I think the best solution would be to have the raw_hid_receive_kb be called no matter what.

That way, when changes are made (such as the layout options), that can be read by the kb level code, and cached/stored locally, rather than having to constantly read the EEPROM or stored globally.

from keyboards.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.