diff --git a/project/example/ble/ble_peripheral/app/src/Mode.c b/project/example/ble/ble_peripheral/app/src/Mode.c index f61380a..c94a739 100644 --- a/project/example/ble/ble_peripheral/app/src/Mode.c +++ b/project/example/ble/ble_peripheral/app/src/Mode.c @@ -155,6 +155,8 @@ void Mode0(){ // #define THREE_COLOR_WAIT_COLD 7U #define THREE_COLOR_WAIT_WARM 8U #define OVERLAP_GRADIENT_LEVEL 40U +#define OVERLAP_NEUTRAL_LOW 20U +#define OVERLAP_NEUTRAL_PEAK 50U static uint8_t breathespeed_flag=0; //该变量只是用来处理三种颜色呼吸时候,对中性光的速度变大 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; } break; case 4U: - if(C_PWM>0U){ C_PWM--; W_PWM++; } + if(W_PWMOVERLAP_NEUTRAL_LOW){ W_PWM++; C_PWM--; } 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; case 5U: + 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: C_PWM=0U; driveMode=1U; if(W_PWM<100U) W_PWM++;