sekigon-gonnoc / qmk_firmware

keyboard controller firmware for Atmel AVR and ARM USB families
http://qmk.fm
GNU General Public License v2.0
202 stars 82 forks source link

RGB backlighting doesn't work without USB #28

Closed joric closed 4 years ago

joric commented 4 years ago

Can you please help enabling RGB on battery power (I have a large Li-Po and enough current to keep it running for a while)? Looks like RGB stops working without USB but for gods sake I can't find the culprit, rgblight_task seems to be called normally and there are no RGB disabling calls in the usbd.c. Video:

https://youtu.be/H9Vw5rEFeG4

Firmware in question: https://github.com/joric/qmk/wiki/jorne_ble (mostly taken from helix_ble).

Also there's no sync between halves, slave LED's don't work, even with RGBLIGHT_SPLIT enabled.

joric commented 4 years ago

OK I got it! How could I overlook it? It was an explicit condition in ws2812 driver:

diff --git a/drivers/nrf52/ws2812.c b/drivers/nrf52/ws2812.c
index 048f020ff..57b5f8ec5 100644
--- a/drivers/nrf52/ws2812.c
+++ b/drivers/nrf52/ws2812.c
@@ -38,10 +38,7 @@ void pwm_handler(nrfx_pwm_evt_type_t event_type) {
 }

 void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds) {
-  if (nrfx_power_usbstatus_get() == NRFX_POWER_USB_STATE_CONNECTED ||
-      nrfx_power_usbstatus_get() == NRFX_POWER_USB_STATE_READY) {
-    ws2812_setleds_pin(ledarray, number_of_leds, RGB_DI_PIN);
-  }
+  ws2812_setleds_pin(ledarray, number_of_leds, RGB_DI_PIN);
 }

 void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask){

RGB sync doesn't work just yet and there's no eeprom support but that thing above was the worst.

Will upload patched firmware here https://github.com/joric/qmk/wiki/jorne_ble

Also the signal undershoots a little bit (maybe at 3.3V), so DUMMY_SIGNAL_LEN 16 fixes that.

Upd. Added eeprom support here https://github.com/joric/qmk/commit/e9f004b61b2043dfd2d28fa6a7b79ecac8b869a9 and fixed RGB sync here: https://github.com/joric/qmk/commit/b6363608f97c91fdfb4b28cb1c48832b1bb8e9b2.

elfmimi commented 4 years ago

How could you overlook it?