mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
fix USB LED animation color on slot change
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user