优化H桥PWM并增加平滑调光
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
#include "math.h"
|
||||
#include "timeslice.h"
|
||||
#include "RF433.h"
|
||||
#include "usr_server.h"
|
||||
#include "usr_server.h"
|
||||
#include "light_transition.h"
|
||||
|
||||
|
||||
uint16_t time_1[11]={8,10,12,14,16,18,20,22,24,26,26};
|
||||
@@ -22,15 +23,15 @@ uint8_t choose_mode_falsg=0; //ģʽֵ
|
||||
uint8_t choose_mode_bh=0; //模式变化
|
||||
|
||||
uint16_t Color_table_static[3][2]={
|
||||
{10,0}, //暖光
|
||||
{4,4}, //中性光
|
||||
{0,10}, //冷光
|
||||
{100,0}, // warm light
|
||||
{50,50}, // neutral light
|
||||
{0,100}, // cool light
|
||||
};
|
||||
|
||||
|
||||
uint16_t Color_table[3][2]={ //动态时候的数组
|
||||
{100,0}, //暖光
|
||||
{40,40}, //中性光
|
||||
{50,50}, //中性光
|
||||
{0,100}, //冷光
|
||||
};
|
||||
|
||||
@@ -45,20 +46,21 @@ void Set_timing(){
|
||||
}
|
||||
}
|
||||
}
|
||||
void Start_PWM(){
|
||||
void Start_PWM(){
|
||||
Light_Transition_RequestOn();
|
||||
deviceStatus=POWERON;
|
||||
startTimer(&timer1,1);
|
||||
}
|
||||
|
||||
|
||||
void Stop_PWM(){
|
||||
deviceStatus=POWEROFF;
|
||||
xc_gpio_write_pin(IO_PWM_W, GPIO_PIN_RESET);
|
||||
xc_gpio_write_pin(IO_PWM_C, GPIO_PIN_RESET);
|
||||
Light_Transition_RequestOff();
|
||||
deviceStatus=POWEROFF;
|
||||
}
|
||||
|
||||
|
||||
void set_mode(){
|
||||
void set_mode(){
|
||||
Light_Transition_Task();
|
||||
if(choose_mode_bh==0){
|
||||
choose_mode_bh=1;
|
||||
switch(choose_mode_falsg){
|
||||
@@ -148,7 +150,7 @@ void set_mode(){
|
||||
}
|
||||
}
|
||||
void Mode0(){ //常量
|
||||
UpdateDisplay();
|
||||
(void)0;/* transition */
|
||||
}
|
||||
|
||||
|
||||
@@ -263,8 +265,8 @@ void Mode1(){ //
|
||||
break;
|
||||
}
|
||||
}
|
||||
//UpdateDisplay();
|
||||
UpdateDisplay_1();
|
||||
//(void)0;/* transition */
|
||||
(void)0;/* transition */
|
||||
}
|
||||
|
||||
|
||||
@@ -337,12 +339,12 @@ void Mode2(){ //
|
||||
break;
|
||||
}
|
||||
}
|
||||
UpdateDisplay_1();
|
||||
(void)0;/* transition */
|
||||
}
|
||||
|
||||
void Mode3(){ //爆闪 //无
|
||||
|
||||
UpdateDisplay();
|
||||
(void)0;/* transition */
|
||||
}
|
||||
pfunc modefunctin[] = { //模式切换,一共15个模式
|
||||
Mode0,
|
||||
|
||||
Reference in New Issue
Block a user