基本要求已经完成,准第一版
This commit is contained in:
parent
ec2ed2d196
commit
3b6408a650
11 changed files with 1286 additions and 1256 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -9,7 +9,7 @@ TriggerName=main
|
|||
LimitSize=0
|
||||
ByteLimit=50
|
||||
[DebugChecksum]
|
||||
Checksum=-1025348935
|
||||
Checksum=-253352013
|
||||
[CodeCoverage]
|
||||
Enabled=_ 0
|
||||
[Exceptions]
|
||||
|
|
@ -99,7 +99,10 @@ SumSortOrder=0
|
|||
[Disassemble mode]
|
||||
mode=0
|
||||
[Breakpoints2]
|
||||
Count=0
|
||||
Bp0=_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\src\app\tft.c}.728.13" 0 0 1 "" 0 "" 0
|
||||
Bp1=_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\src\app\plan_handle.c}.213.5" 0 0 1 "" 0 "" 0
|
||||
Bp2=_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\src\app\tft.c}.999.9" 0 0 1 "" 0 "" 0
|
||||
Count=3
|
||||
[Log file]
|
||||
LoggingEnabled=_ 0
|
||||
LogFile=_ ""
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
|
||||
|
||||
|
||||
#define PM_DEBUG
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 模拟定时器使用的定时器
|
||||
|
|
@ -37,8 +41,8 @@
|
|||
#define AMS_KEY_PINX PTD5
|
||||
#define WIFI_KEY_PINX PTD7
|
||||
#define MR_KEY_PINX PTE23
|
||||
#define MB_KEY_PINX PTA16
|
||||
#define MUVB_KEY_PINX PTD4
|
||||
#define MB_KEY_PINX PTD4
|
||||
#define MUVB_KEY_PINX PTA16
|
||||
// knob用必须是PTA或PTD端口的
|
||||
#define KNOB_A_PINX PTD7
|
||||
#define KNOB_B_PINX PTD6
|
||||
|
|
@ -64,8 +68,8 @@
|
|||
*
|
||||
*/
|
||||
#define LGRED_PINX PTC17
|
||||
#define LGBLUE_PINX PTC16
|
||||
#define LGUVB_PINX PTC13
|
||||
#define LGBLUE_PINX PTC13
|
||||
#define LGUVB_PINX PTC16
|
||||
#define WATER_PINX PTD1
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ typedef struct plan_input_
|
|||
uint8_t lg_uvb : 1;
|
||||
uint8_t water : 1;
|
||||
uint8_t sw : 1;
|
||||
uint8_t cnt;
|
||||
} plan_input;
|
||||
|
||||
typedef struct kv_pair_
|
||||
|
|
|
|||
|
|
@ -21,14 +21,17 @@ void main(void)
|
|||
{
|
||||
|
||||
printf("\n\n\n程序开始执行!!!\n\n\n");
|
||||
|
||||
enter_critical();
|
||||
pm_init();
|
||||
exit_critical();
|
||||
|
||||
st_init(0, COMPARE, 10); // 作为按键扫描函数的定时使用,在simulat_timer.c的底层中使用
|
||||
st_init(1, COMPARE, 100);
|
||||
|
||||
#ifdef PM_DEBUG
|
||||
st_init(2, COMPARE, 1);
|
||||
st_init(3, COMPARE, 500);
|
||||
#endif /* PM_DEBUG */
|
||||
|
||||
knob_enable();
|
||||
|
||||
|
|
@ -56,6 +59,7 @@ void main(void)
|
|||
plan_handle();
|
||||
}
|
||||
|
||||
#ifdef PM_DEBUG
|
||||
/*
|
||||
* 调试相关,较短时间响应
|
||||
*/
|
||||
|
|
@ -81,11 +85,11 @@ void main(void)
|
|||
st.hour, st.min, st.sec);
|
||||
printf("sec = %d\n", calendar_to_sec(&st));
|
||||
calendar_info test_t;
|
||||
test_t.year = START_YEAR;
|
||||
test_t.month = 1;
|
||||
test_t.mday = 1;
|
||||
test_t.hour = 0;
|
||||
test_t.min = 0;
|
||||
test_t.year = 2016;
|
||||
test_t.month = 5;
|
||||
test_t.mday = 5;
|
||||
test_t.hour = 12;
|
||||
test_t.min = 25;
|
||||
test_t.sec = 0;
|
||||
uint32_t test_sec = calendar_to_sec(&test_t);
|
||||
printf("test_sec = %d\n", test_sec);
|
||||
|
|
@ -105,6 +109,7 @@ void main(void)
|
|||
printf("手动!!!!!!\n");
|
||||
}
|
||||
}
|
||||
#endif /* PM_DEBUG */
|
||||
|
||||
key_func();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ void orient_init(void)
|
|||
{
|
||||
uart_init(ORIENT_UARTX, 2400);
|
||||
gpio_init(RE_DE_PINX, 1, 1);
|
||||
|
||||
orient_setmode(0, MODE_MANUL);
|
||||
orient_setmode(1, MODE_MANUL);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -29,9 +29,14 @@
|
|||
typedef struct plan_output_
|
||||
{
|
||||
uint8_t is_reach;
|
||||
uint8_t cnt;
|
||||
uint8_t note[10];
|
||||
} plan_output;
|
||||
|
||||
typedef enum lg_state_
|
||||
{
|
||||
LIGHT = 1, NO_LIGHT = 0
|
||||
} lg_state;
|
||||
|
||||
|
||||
static void indata_to_outdata(plan_input *ind, plan_output *outd);
|
||||
static void plan_ctr_exe(uint8_t activity);
|
||||
|
|
@ -48,14 +53,14 @@ plan_input plan_in[PLAN_DATA_NUM] = { 0 };
|
|||
|
||||
void plan_handle_init(void)
|
||||
{
|
||||
gpio_Interrupt_init(LGRED_PINX, GPO, GPI_DISAB);
|
||||
gpio_Interrupt_init(LGBLUE_PINX, GPO, GPI_DISAB);
|
||||
gpio_Interrupt_init(LGUVB_PINX, GPO, GPI_DISAB);
|
||||
gpio_Interrupt_init(WATER_PINX, GPO, GPI_DISAB);
|
||||
gpio_init(LGRED_PINX, 1, NO_LIGHT);
|
||||
gpio_init(LGBLUE_PINX, 1, NO_LIGHT);
|
||||
gpio_init(LGUVB_PINX, 1, NO_LIGHT);
|
||||
gpio_init(WATER_PINX, 1, 0);
|
||||
|
||||
gpio_Interrupt_init(LG1_PINX, GPO, GPI_DISAB);
|
||||
gpio_Interrupt_init(LG2_PINX, GPO, GPI_DISAB);
|
||||
gpio_Interrupt_init(LG3_PINX, GPO, GPI_DISAB);
|
||||
gpio_init(LG1_PINX, 1, 1);
|
||||
gpio_init(LG2_PINX, 1, 1);
|
||||
gpio_init(LG3_PINX, 1, 1);
|
||||
// 还有设置方向的初始化
|
||||
|
||||
/*
|
||||
|
|
@ -77,10 +82,11 @@ static void indata_to_outdata(plan_input *ind, plan_output *outd)
|
|||
ind->pd_t.year = START_YEAR;
|
||||
ind->pd_t.month = 1;
|
||||
ind->pd_t.mday = 1;
|
||||
ind->pd_t.sec = 0;
|
||||
uint32_t pd_sec = calendar_to_sec(&ind->pd_t);
|
||||
|
||||
uint32_t ctr_bg_sec = calendar_to_sec(&ind->bg_t) + pd_sec * outd->cnt;
|
||||
uint32_t ctr_ed_sec = calendar_to_sec(&ind->ed_t) + pd_sec * outd->cnt;
|
||||
uint32_t ctr_bg_sec = calendar_to_sec(&ind->bg_t) + pd_sec * ind->cnt;
|
||||
uint32_t ctr_ed_sec = calendar_to_sec(&ind->ed_t) + pd_sec * ind->cnt;
|
||||
|
||||
if (ctr_bg_sec < sys_sec && ctr_ed_sec > sys_sec)
|
||||
{
|
||||
|
|
@ -90,7 +96,7 @@ static void indata_to_outdata(plan_input *ind, plan_output *outd)
|
|||
{
|
||||
if (outd->is_reach == 1)
|
||||
{
|
||||
outd->cnt++;
|
||||
ind->cnt++;
|
||||
}
|
||||
outd->is_reach = 0;
|
||||
}
|
||||
|
|
@ -98,23 +104,24 @@ static void indata_to_outdata(plan_input *ind, plan_output *outd)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
static void plan_ctr_exe(uint8_t activity)
|
||||
{
|
||||
if (activity >= PLAN_DATA_NUM)
|
||||
{
|
||||
gpio_set(LGRED_PINX, 0);
|
||||
gpio_set(LGBLUE_PINX, 0);
|
||||
gpio_set(LGUVB_PINX, 0);
|
||||
gpio_set(WATER_PINX, 0);
|
||||
gpio_set(LGRED_PINX, NO_LIGHT);
|
||||
gpio_set(LGBLUE_PINX, NO_LIGHT);
|
||||
gpio_set(LGUVB_PINX, NO_LIGHT);
|
||||
gpio_set(WATER_PINX, NO_LIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
orient_presetop(0, PRESET_CALL, activity + 1);
|
||||
orient_presetop(1, PRESET_CALL, activity + 1);
|
||||
gpio_set(LGRED_PINX, plan_in[activity].lg_r);
|
||||
gpio_set(LGBLUE_PINX, plan_in[activity].lg_b);
|
||||
gpio_set(LGUVB_PINX, plan_in[activity].lg_uvb);
|
||||
gpio_set(WATER_PINX, plan_in[activity].water);
|
||||
gpio_set(LGRED_PINX, plan_in[activity].lg_r == 1 ? LIGHT : NO_LIGHT);
|
||||
gpio_set(LGBLUE_PINX, plan_in[activity].lg_b == 1 ? LIGHT : NO_LIGHT);
|
||||
gpio_set(LGUVB_PINX, plan_in[activity].lg_uvb == 1 ? LIGHT : NO_LIGHT);
|
||||
gpio_set(WATER_PINX, plan_in[activity].water == 1 ? LIGHT : NO_LIGHT);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -186,6 +193,7 @@ void tft_to_plan_input(uint8_t objn)
|
|||
plan_in[objn].bg_t.mday = *get_value_of_kvp("bg_d", objn);
|
||||
plan_in[objn].bg_t.hour = *get_value_of_kvp("bg_h", objn);
|
||||
plan_in[objn].bg_t.min = *get_value_of_kvp("bg_mi", objn);
|
||||
plan_in[objn].bg_t.sec = 0;
|
||||
|
||||
/*
|
||||
* 结束时间在tft条目没有年、月、日,赋值为何开始时间相同
|
||||
|
|
@ -195,17 +203,19 @@ void tft_to_plan_input(uint8_t objn)
|
|||
plan_in[objn].ed_t.mday = plan_in[objn].bg_t.mday;
|
||||
plan_in[objn].ed_t.hour = *get_value_of_kvp("ed_h", objn);
|
||||
plan_in[objn].ed_t.min = *get_value_of_kvp("ed_mi", objn);
|
||||
plan_in[objn].ed_t.sec = 0;
|
||||
|
||||
plan_in[objn].pd_t.mday = *get_value_of_kvp("pd_d", objn);
|
||||
plan_in[objn].pd_t.hour = *get_value_of_kvp("pd_h", objn);
|
||||
plan_in[objn].pd_t.min = *get_value_of_kvp("pd_mi", objn);
|
||||
|
||||
plan_in[objn].lg_r = *get_value_of_kvp("lg_r", objn);
|
||||
plan_in[objn].lg_b = *get_value_of_kvp("lg_b)", objn);
|
||||
plan_in[objn].lg_b = *get_value_of_kvp("lg_b", objn);
|
||||
plan_in[objn].lg_uvb = *get_value_of_kvp("lg_uvb", objn);
|
||||
plan_in[objn].water = *get_value_of_kvp("water", objn);
|
||||
|
||||
plan_in[objn].sw = *get_value_of_kvp("sw", objn);
|
||||
plan_in[objn].cnt = *get_value_of_kvp("cnt", objn);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -245,6 +255,7 @@ static void plan_inpu_to_tft(void)
|
|||
*get_value_of_kvp("water", objn) = plan_in[objn].water;
|
||||
|
||||
*get_value_of_kvp("sw", objn) = plan_in[objn].sw;
|
||||
*get_value_of_kvp("cnt", objn) = plan_in[objn].cnt;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -473,7 +484,7 @@ static void manul_key_func(void)
|
|||
case S_KEY:
|
||||
printf("MR_KEY 单击\n");
|
||||
mlgr = !mlgr;
|
||||
gpio_set(LGRED_PINX, mlgr);
|
||||
gpio_set(LGRED_PINX, mlgr == 1 ? LIGHT : NO_LIGHT);
|
||||
break;
|
||||
case D_KEY:
|
||||
printf("MR_KEY 双击\n");
|
||||
|
|
@ -492,7 +503,7 @@ static void manul_key_func(void)
|
|||
case S_KEY:
|
||||
printf("MB_KEY 单击\n");
|
||||
mlgb = !mlgb;
|
||||
gpio_set(LGBLUE_PINX, mlgb);
|
||||
gpio_set(LGBLUE_PINX, mlgb == 1 ? LIGHT : NO_LIGHT);
|
||||
break;
|
||||
case D_KEY:
|
||||
printf("MB_KEY 双击\n");
|
||||
|
|
@ -511,7 +522,7 @@ static void manul_key_func(void)
|
|||
case S_KEY:
|
||||
printf("MUVB_KEY 单击\n");
|
||||
mlguvb = !mlguvb;
|
||||
gpio_set(LGUVB_PINX, mlguvb);
|
||||
gpio_set(LGUVB_PINX, mlguvb == 1 ? LIGHT : NO_LIGHT);
|
||||
break;
|
||||
case D_KEY:
|
||||
printf("MUVB_KEY 双击\n");
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
|
|||
{ "lg_r", 0, RW_PIC}, { "lg_b", 0, RW_PIC }, { "lg_uvb", 0, RW_PIC }, { "water", 0, RW_PIC }, // 9~12
|
||||
{ "pd_d", 3, RW_NUM }, { "pd_h", 3, RW_NUM }, { "pd_mi", 3, RW_NUM }, // 13~15
|
||||
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
|
||||
{ "cnt", 0, R_NUM } //18
|
||||
{ "cnt", 0, RW_NUM } //18
|
||||
}, // 0
|
||||
{
|
||||
{ "ob", 2, R_NUM}, { "sw", 1, RW_PIC },// 0~1
|
||||
|
|
@ -160,7 +160,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
|
|||
{ "lg_r", 0, RW_PIC}, { "lg_b", 0, RW_PIC }, { "lg_uvb", 0, RW_PIC }, { "water", 0, RW_PIC }, // 9~12
|
||||
{ "pd_d", 3, RW_NUM }, { "pd_h", 3, RW_NUM }, { "pd_mi", 3, RW_NUM }, // 13~15
|
||||
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
|
||||
{ "cnt", 0, R_NUM } //18
|
||||
{ "cnt", 0, RW_NUM } //18
|
||||
}, // 1
|
||||
{
|
||||
{ "ob", 3, R_NUM}, { "sw", 1, RW_PIC },// 0~1
|
||||
|
|
@ -169,7 +169,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
|
|||
{ "lg_r", 0, RW_PIC}, { "lg_b", 0, RW_PIC }, { "lg_uvb", 0, RW_PIC }, { "water", 0, RW_PIC }, // 9~12
|
||||
{ "pd_d", 3, RW_NUM }, { "pd_h", 3, RW_NUM }, { "pd_mi", 3, RW_NUM }, // 13~15
|
||||
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
|
||||
{ "cnt", 0, R_NUM } //18
|
||||
{ "cnt", 0, RW_NUM } //18
|
||||
}, // 2
|
||||
{
|
||||
{ "ob", 4, R_NUM}, { "sw", 1, RW_PIC },// 0~1
|
||||
|
|
@ -178,7 +178,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
|
|||
{ "lg_r", 0, RW_PIC}, { "lg_b", 0, RW_PIC }, { "lg_uvb", 0, RW_PIC }, { "water", 0, RW_PIC }, // 9~12
|
||||
{ "pd_d", 3, RW_NUM }, { "pd_h", 3, RW_NUM }, { "pd_mi", 3, RW_NUM }, // 13~15
|
||||
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
|
||||
{ "cnt", 0, R_NUM } //18
|
||||
{ "cnt", 0, RW_NUM } //18
|
||||
}, // 3
|
||||
{
|
||||
{ "ob", 5, R_NUM}, { "sw", 1, RW_PIC },// 0~1
|
||||
|
|
@ -187,7 +187,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
|
|||
{ "lg_r", 0, RW_PIC}, { "lg_b", 0, RW_PIC }, { "lg_uvb", 0, RW_PIC }, { "water", 0, RW_PIC }, // 9~12
|
||||
{ "pd_d", 3, RW_NUM }, { "pd_h", 3, RW_NUM }, { "pd_mi", 3, RW_NUM }, // 13~15
|
||||
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
|
||||
{ "cnt", 0, R_NUM } //18
|
||||
{ "cnt", 0, RW_NUM } //18
|
||||
}, // 4
|
||||
{
|
||||
{ "ob", 6, R_NUM}, { "sw", 1, RW_PIC },// 0~1
|
||||
|
|
@ -196,7 +196,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
|
|||
{ "lg_r", 0, RW_PIC}, { "lg_b", 0, RW_PIC }, { "lg_uvb", 0, RW_PIC }, { "water", 0, RW_PIC }, // 9~12
|
||||
{ "pd_d", 3, RW_NUM }, { "pd_h", 3, RW_NUM }, { "pd_mi", 3, RW_NUM }, // 13~15
|
||||
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
|
||||
{ "cnt", 0, R_NUM } //18
|
||||
{ "cnt", 0, RW_NUM } //18
|
||||
}, // 5
|
||||
{
|
||||
{ "ob", 7, R_NUM}, { "sw", 1, RW_PIC },// 0~1
|
||||
|
|
@ -205,7 +205,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
|
|||
{ "lg_r", 0, RW_PIC}, { "lg_b", 0, RW_PIC }, { "lg_uvb", 0, RW_PIC }, { "water", 0, RW_PIC }, // 9~12
|
||||
{ "pd_d", 3, RW_NUM }, { "pd_h", 3, RW_NUM }, { "pd_mi", 3, RW_NUM }, // 13~15
|
||||
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
|
||||
{ "cnt", 0, R_NUM } //18
|
||||
{ "cnt", 0, RW_NUM } //18
|
||||
}, // 6
|
||||
{
|
||||
{ "ob", 8, R_NUM}, { "sw", 1, RW_PIC },// 0~1
|
||||
|
|
@ -214,7 +214,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
|
|||
{ "lg_r", 0, RW_PIC}, { "lg_b", 0, RW_PIC }, { "lg_uvb", 0, RW_PIC }, { "water", 0, RW_PIC }, // 9~12
|
||||
{ "pd_d", 3, RW_NUM }, { "pd_h", 3, RW_NUM }, { "pd_mi", 3, RW_NUM }, // 13~15
|
||||
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
|
||||
{ "cnt", 0, R_NUM } //18
|
||||
{ "cnt", 0, RW_NUM } //18
|
||||
}, // 7
|
||||
};
|
||||
|
||||
|
|
@ -1097,6 +1097,11 @@ input_limit tft_input_limit(char *name)
|
|||
in_lmt.min = 0;
|
||||
in_lmt.max = 359;
|
||||
}
|
||||
else if (strcmp(name, "cnt") == 0)
|
||||
{
|
||||
in_lmt.min = 0;
|
||||
in_lmt.max = 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
in_lmt.min = 0;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,2 +1,2 @@
|
|||
[MainWindow]
|
||||
WindowPlacement=_ 139 121 1164 647 3
|
||||
WindowPlacement=_ 1494 249 2519 775 3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue