fix USB LED animation color on slot change

This commit is contained in:
Philippe Teuwen
2023-08-22 19:44:20 +02:00
parent 120971c466
commit 2ce2e25827
3 changed files with 9 additions and 0 deletions
@@ -7,6 +7,7 @@
#include "fds_util.h"
#include "tag_emulation.h"
#include "tag_persistence.h"
#include "rgb_marquee.h"
#define NRF_LOG_MODULE_NAME tag_emu
@@ -458,6 +459,7 @@ uint8_t tag_emulation_get_slot(void) {
*/
void tag_emulation_set_slot(uint8_t index) {
slotConfig.config.activated = index; // 重设到新切换的卡槽上
rgb_marquee_reset(); // force animation color refresh according to new slot
}
/**
+6
View File
@@ -50,6 +50,12 @@ void rgb_marquee_stop(void){
ledblink1_step = 0;
}
// reset RGB state machines to force a refresh of the LED color
void rgb_marquee_reset(void){
ledblink6_step = 0;
ledblink1_step = 0;
}
// 亮度转PWM值
uint16_t get_pwmduty(uint8_t light_level){
return PWM_MAX-(PWM_MAX*pow(((double)light_level/LIGHT_LEVEL_MAX),2.2));
+1
View File
@@ -7,6 +7,7 @@
void rgb_marquee_init(void);
void rgb_marquee_stop(void);
void rgb_marquee_reset(void);
bool is_rgb_marquee_enable(void);
void ledblink1(uint8_t color,uint8_t dir);
void ledblink2(uint8_t color,uint8_t dir, uint8_t end);