为交叠渐变加入中性光

This commit is contained in:
2026-07-28 14:10:42 +08:00
parent 71e4bb628a
commit 3dae15c011
@@ -155,6 +155,8 @@ void Mode0(){ //
#define THREE_COLOR_WAIT_COLD 7U #define THREE_COLOR_WAIT_COLD 7U
#define THREE_COLOR_WAIT_WARM 8U #define THREE_COLOR_WAIT_WARM 8U
#define OVERLAP_GRADIENT_LEVEL 40U #define OVERLAP_GRADIENT_LEVEL 40U
#define OVERLAP_NEUTRAL_LOW 20U
#define OVERLAP_NEUTRAL_PEAK 50U
static uint8_t breathespeed_flag=0; //该变量只是用来处理三种颜色呼吸时候,对中性光的速度变大 static uint8_t breathespeed_flag=0; //该变量只是用来处理三种颜色呼吸时候,对中性光的速度变大
static void breathe_fun(uint16_t *PWM_1, uint16_t *PWM_2, uint8_t flag) { static void breathe_fun(uint16_t *PWM_1, uint16_t *PWM_2, uint8_t flag) {
@@ -375,11 +377,26 @@ void Mode3(void)
if(C_PWM<=OVERLAP_GRADIENT_LEVEL){ C_PWM=OVERLAP_GRADIENT_LEVEL; direction=4U; } if(C_PWM<=OVERLAP_GRADIENT_LEVEL){ C_PWM=OVERLAP_GRADIENT_LEVEL; direction=4U; }
break; break;
case 4U: case 4U:
if(C_PWM>0U){ C_PWM--; W_PWM++; } if(W_PWM<OVERLAP_NEUTRAL_LOW && C_PWM>OVERLAP_NEUTRAL_LOW){ W_PWM++; C_PWM--; }
driveMode=0U; driveMode=0U;
if(C_PWM==0U){ W_PWM=OVERLAP_GRADIENT_LEVEL; driveMode=1U; direction=5U; } if(W_PWM>=OVERLAP_NEUTRAL_LOW){ W_PWM=OVERLAP_NEUTRAL_LOW; C_PWM=OVERLAP_NEUTRAL_LOW; direction=5U; }
break; break;
case 5U: case 5U:
if(W_PWM<OVERLAP_NEUTRAL_PEAK){ W_PWM++; C_PWM++; }
driveMode=0U;
if(W_PWM>=OVERLAP_NEUTRAL_PEAK){ W_PWM=OVERLAP_NEUTRAL_PEAK; C_PWM=OVERLAP_NEUTRAL_PEAK; direction=6U; }
break;
case 6U:
if(W_PWM>OVERLAP_NEUTRAL_LOW){ W_PWM--; C_PWM--; }
driveMode=0U;
if(W_PWM<=OVERLAP_NEUTRAL_LOW){ W_PWM=OVERLAP_NEUTRAL_LOW; C_PWM=OVERLAP_NEUTRAL_LOW; direction=7U; }
break;
case 7U:
if(C_PWM>0U){ C_PWM--; W_PWM++; }
driveMode=0U;
if(C_PWM==0U){ W_PWM=OVERLAP_GRADIENT_LEVEL; driveMode=1U; direction=8U; }
break;
case 8U:
default: default:
C_PWM=0U; driveMode=1U; C_PWM=0U; driveMode=1U;
if(W_PWM<100U) W_PWM++; if(W_PWM<100U) W_PWM++;