完成转向功能测试;加入手动自动的基础功能;计划执行部分写完,未实际测试

This commit is contained in:
forbelief 2016-04-29 17:01:10 +08:00
parent 7d46287def
commit ec2ed2d196
21 changed files with 2020 additions and 1680 deletions

File diff suppressed because it is too large Load diff

View file

@ -1906,12 +1906,6 @@
<file>
<name>$PROJ_DIR$\..\src\app\include\debug.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\display.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\flash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\input.h</name>
</file>
@ -1930,6 +1924,15 @@
<file>
<name>$PROJ_DIR$\..\src\app\include\plan_handle.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\pm_flash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\pm_flash_cfg.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\pm_init.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\pm_time.h</name>
</file>
@ -1942,6 +1945,9 @@
<file>
<name>$PROJ_DIR$\..\src\app\include\tft.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\tft_plan_internal.h</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\src\app\debug.c</name>
@ -1961,12 +1967,6 @@
<file>
<name>$PROJ_DIR$\..\src\app\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\NormalDemo_Flash.c</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\orient.c</name>
</file>

View file

@ -182,12 +182,6 @@
<file>
<name>$PROJ_DIR$\..\src\app\include\debug.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\display.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\flash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\input.h</name>
</file>
@ -206,6 +200,15 @@
<file>
<name>$PROJ_DIR$\..\src\app\include\plan_handle.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\pm_flash.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\pm_flash_cfg.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\pm_init.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\pm_time.h</name>
</file>
@ -218,6 +221,9 @@
<file>
<name>$PROJ_DIR$\..\src\app\include\tft.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\include\tft_plan_internal.h</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\src\app\debug.c</name>
@ -237,9 +243,6 @@
<file>
<name>$PROJ_DIR$\..\src\app\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\NormalDemo_Flash.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\app\orient.c</name>
</file>

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@ TriggerName=main
LimitSize=0
ByteLimit=50
[DebugChecksum]
Checksum=828444786
Checksum=-1025348935
[CodeCoverage]
Enabled=_ 0
[Exceptions]
@ -19,19 +19,6 @@ StopOnThrow=_ 0
ShowArgs=0
[Disassembly]
MixedMode=1
[InterruptLog]
LogEnabled=0
SumEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=1
SumSortOrder=0
[DataLog]
LogEnabled=0
SumEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=1
[Interrupts]
Enabled=1
[MemConfig]
@ -48,17 +35,71 @@ CStepIntDis=_ 0
TraceBufferSize=0x00010000
TraceStallIfFIFOFull=0x00000000
TracePortSize=0x00000004
[SWOTraceHWSettings]
OverrideDefaultClocks=0
CpuClock=72000000
ClockAutoDetect=0
ClockWanted=2000000
JtagSpeed=2000000
Prescaler=36
TimeStampPrescIndex=0
TimeStampPrescData=0
PcSampCYCTAP=1
PcSampPOSTCNT=15
PcSampIndex=0
DataLogMode=0
ITMportsEnable=0
ITMportsTermIO=0
ITMportsLogFile=0
ITMlogFile=$PROJ_DIR$\ITM.log
[Trace1]
Enabled=0
ShowSource=1
[Trace2]
Enabled=0
ShowSource=0
[SWOTraceWindow]
PcSampling=0
InterruptLogs=0
ForcedTimeStamps=0
EventCPI=0
EventEXC=0
EventFOLD=0
EventLSU=0
EventSLEEP=0
[PowerLog]
LogEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=0
Title_0=I0
Symbol_0=0 4 1
LiveEnabled=0
LiveFile=PowerLogLive.log
[DataLog]
LogEnabled=0
SumEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=1
[EventLog]
LogEnabled=0
SumEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=1
SumSortOrder=0
[InterruptLog]
LogEnabled=0
SumEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=1
SumSortOrder=0
[Disassemble mode]
mode=0
[Breakpoints2]
Bp0=_ 0 "EMUL_CODE" "{$PROJ_DIR$\..\src\app\tft.c}.883.5" 0 0 1 "" 0 "" 0
Bp1=_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\src\app\tft.c}.542.9" 0 0 1 "" 0 "" 0
Bp2=_ 0 "EMUL_CODE" "{$PROJ_DIR$\..\src\app\pm_flash.c}.95.5" 0 0 1 "" 0 "" 0
Bp3=_ 0 "EMUL_CODE" "{$PROJ_DIR$\..\src\app\plan_handle.c}.55.5" 0 0 1 "" 0 "" 0
Count=4
Count=0
[Log file]
LoggingEnabled=_ 0
LogFile=_ ""
@ -71,6 +112,10 @@ Count=0
SuppressDialog=0
[CallStackLog]
Enabled=0
[PowerProbe]
Frequency=10000
Probe0=I0
ProbeSetup0=2 1 1 2 0 0
[DriverProfiling]
Enabled=0
Mode=1

Binary file not shown.

View file

@ -35,7 +35,7 @@ void orient_init(void);
void orient_setspeed(uint8_t addr, orient ori, uint8_t spd);
void orient_setpreset(uint8_t addr, preset_op op, uint8_t npre);
void orient_presetop(uint8_t addr, preset_op op, uint8_t npre);
void orient_setmode(uint8_t addr, orient_mode mod);

View file

@ -11,4 +11,5 @@ void plan_handle_init(void);
void plan_handle(void);
void tft_to_plan_input(uint8_t objn);
void key_func(void);

View file

@ -14,7 +14,7 @@ void pm_flash_init(void);
void flash_write(uint8_t *saddr, uint16_t nbyte);
void flash_read(uint8_t *daddr, uint8_t nbyte);
void flash_read(uint8_t *daddr, uint16_t nbyte);

View file

@ -17,6 +17,7 @@ typedef struct calendar_info_
uint16_t yday;
} calendar_info;
enum { START_YEAR = 2000, SEC_IN_DAY = 24 * 60 * 60};
uint8_t is_leapyear(uint16_t year);

View file

@ -34,3 +34,7 @@ enum { PLAN_DATA_NUM = 19 };
extern plan_input plan_in[PLAN_DATA_NUM];
extern kv_pair kvp_obj_set[][PLAN_DATA_NUM];
void tft_to_plan_input(uint8_t objn);

View file

@ -13,6 +13,7 @@
#include "include/pm_time.h"
#include "include/plan_handle.h"
#include "include/pm_flash.h"
#include "include/orient.h"
@ -24,7 +25,7 @@ void main(void)
pm_init();
st_init(0, COMPARE, 10); // 作为按键扫描函数的定时使用在simulat_timer.c的底层中使用
st_init(1, COMPARE, 500);
st_init(1, COMPARE, 100);
st_init(2, COMPARE, 1);
st_init(3, COMPARE, 500);
@ -32,6 +33,8 @@ void main(void)
knob_enable();
while (1)
{
/*
@ -77,85 +80,33 @@ void main(void)
st.year, st.month, st.wday, st.mday,
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.sec = 0;
uint32_t test_sec = calendar_to_sec(&test_t);
printf("test_sec = %d\n", test_sec);
static uint8_t lg_test;
lg_test = !lg_test;
gpio_set(LG1_PINX, 0);
gpio_set(LG2_PINX, 0);
gpio_set(LG3_PINX, 0);
if (gpio_get(AMS_KEY_PINX))
{
printf("¼Æ»®!!!!!!\n");
}
else
{
printf("ÊÖ¶¯!!!!!!\n");
}
}
/*
*
*/
switch (get_key_mean(UP_KEY))
{
case N_KEY:
//printf("轟숩\n");
break;
case S_KEY:
printf("데샌\n");
tft_left();
break;
case D_KEY:
printf("崗샌\n");
tft_up();
break;
case L_KEY:
printf("낀객\n");
break;
default:
break;
}
switch (get_key_mean(DOWN_KEY))
{
case N_KEY:
//printf("轟숩\n");
break;
case S_KEY:
printf("데샌\n");
tft_right();
break;
case D_KEY:
printf("崗샌\n");
tft_down();
break;
case L_KEY:
printf("낀객\n");
break;
default:
break;
}
switch (get_key_mean(OK_KEY))
{
case N_KEY:
//printf("轟숩\n");
break;
case S_KEY:
printf("데샌\n");
tft_ok();
break;
case D_KEY:
printf("崗샌\n");
break;
case L_KEY:
printf("낀객\n");
break;
default:
break;
}
switch (get_key_mean(RET_KEY))
{
case N_KEY:
//printf("轟숩\n");
break;
case S_KEY:
printf("데샌\n");
tft_ret();
break;
case D_KEY:
printf("崗샌\n");
break;
case L_KEY:
printf("낀객\n");
break;
default:
break;
}
key_func();
}
return;
}

View file

@ -14,6 +14,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;
@ -60,13 +61,13 @@ void orient_setspeed(uint8_t addr, orient ori, uint8_t spd)
/*
* orient_setpreset() -
* orient_presetop() -
*
* @addr:
* @op:
* @npre:
*/
void orient_setpreset(uint8_t addr, preset_op op, uint8_t npre)
void orient_presetop(uint8_t addr, preset_op op, uint8_t npre)
{
uint8_t cmd[7] = { 0xff, addr, 0x00, 0x00, 0x00, npre, 0x00 };

View file

@ -1,16 +1,16 @@
/*
* plan_handle.c -
* plan_handle.c -
*
*
*
*
*
*
*
* 访
* tft.c模块访
* 访
*
*
*
*
*
*
*
* 访
* tft.c模块访
* 访
*
*/
#include <stdint.h>
@ -23,6 +23,8 @@
#include "include/tft.h"
#include "include/config.h"
#include "include/pm_flash.h"
#include "include/orient.h"
#include "include/key.h"
typedef struct plan_output_
{
@ -32,8 +34,12 @@ typedef struct plan_output_
static void indata_to_outdata(plan_input *ind, plan_output *outd);
static void ctr_exe(uint8_t activity);
static void plan_ctr_exe(uint8_t activity);
static void plan_inpu_to_tft(void);
static void plan_key_func(void);
static void manul_key_func(void);
static void manul_ctr(void);
static void plan_ctr(void);
static plan_output plan_out[PLAN_DATA_NUM] = { 0 };
plan_input plan_in[PLAN_DATA_NUM] = { 0 };
@ -46,10 +52,14 @@ void plan_handle_init(void)
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_Interrupt_init(LG1_PINX, GPO, GPI_DISAB);
gpio_Interrupt_init(LG2_PINX, GPO, GPI_DISAB);
gpio_Interrupt_init(LG3_PINX, GPO, GPI_DISAB);
// 还有设置方向的初始化
/*
* flash到plan_handle模块plan_handle模块到tft模块
* flash到plan_handle模块plan_handle模块到tft模块
*/
flash_read((uint8_t *)&plan_in, sizeof(plan_in));
plan_inpu_to_tft();
@ -64,11 +74,15 @@ static void indata_to_outdata(plan_input *ind, plan_output *outd)
calendar_info st = get_system_time();
uint32_t sys_sec = calendar_to_sec(&st);
ind->pd_t.year = START_YEAR;
ind->pd_t.month = 1;
ind->pd_t.mday = 1;
uint32_t pd_sec = calendar_to_sec(&ind->pd_t);
uint32_t crt_bg_sec = calendar_to_sec(&ind->bg_t) + pd_sec * outd->cnt;
uint32_t crt_ed_sec = calendar_to_sec(&ind->ed_t) + pd_sec * outd->cnt;
if (crt_bg_sec < sys_sec && crt_ed_sec > sys_sec)
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;
if (ctr_bg_sec < sys_sec && ctr_ed_sec > sys_sec)
{
outd->is_reach = 1;
}
@ -84,7 +98,7 @@ static void indata_to_outdata(plan_input *ind, plan_output *outd)
return;
}
static void ctr_exe(uint8_t activity)
static void plan_ctr_exe(uint8_t activity)
{
if (activity >= PLAN_DATA_NUM)
{
@ -95,7 +109,8 @@ static void ctr_exe(uint8_t activity)
}
else
{
//set_orient(plan_in[activity].x_orient, plan_in[activity].y_orient);
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);
@ -105,7 +120,7 @@ static void ctr_exe(uint8_t activity)
}
void plan_handle(void)
void plan_ctr(void)
{
uint8_t activity = PLAN_DATA_NUM;
@ -121,16 +136,48 @@ void plan_handle(void)
}
}
}
ctr_exe(activity);
plan_ctr_exe(activity);
return;
}
void plan_handle(void)
{
if (gpio_get(AMS_KEY_PINX))
{
plan_ctr();
}
else
{
manul_ctr();
}
return;
}
void key_func(void)
{
if (gpio_get(AMS_KEY_PINX))
{
plan_key_func();
}
else
{
manul_key_func();
}
return;
}
void manul_ctr(void)
{
return;
}
/*
* tft_to_plan_input() - tft显示的数据提取到计划处理的输入数据结构中
* @objn: 0~7
* tft_to_plan_input() - tft显示的数据提取到计划处理的输入数据结构中
* @objn: 0~7
*
* tft输入有改变是被调用
* tft输入有改变是被调用
*/
void tft_to_plan_input(uint8_t objn)
{
@ -141,7 +188,7 @@ void tft_to_plan_input(uint8_t objn)
plan_in[objn].bg_t.min = *get_value_of_kvp("bg_mi", objn);
/*
* tft条目没有年
* tft条目没有年
*/
plan_in[objn].ed_t.year = plan_in[objn].bg_t.year;
plan_in[objn].ed_t.month = plan_in[objn].bg_t.month;
@ -165,9 +212,9 @@ void tft_to_plan_input(uint8_t objn)
/*
* plan_inpu_to_tft() - tft
* plan_inpu_to_tft() - tft
*
* flash中恢复的计划数据重新装入tft
* flash中恢复的计划数据重新装入tft
*/
static void plan_inpu_to_tft(void)
{
@ -180,7 +227,7 @@ static void plan_inpu_to_tft(void)
*get_value_of_kvp("bg_mi", objn) = plan_in[objn].bg_t.min;
/*
* tft条目没有年
* tft条目没有年
* *get_value_of_kvp("ed_y", objn) = plan_in[objn].ed_t.year;
* *get_value_of_kvp("ed_mo", objn) = plan_in[objn].ed_t.month;
* *get_value_of_kvp("ed_d", objn) = plan_in[objn].ed_t.mday;
@ -201,3 +248,279 @@ static void plan_inpu_to_tft(void)
}
return;
}
static void plan_key_func(void)
{
/*
*
*/
switch (get_key_mean(UP_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("UP_KEY 单击\n");
tft_left();
break;
case D_KEY:
printf("UP_KEY 双击\n");
tft_up();
break;
case L_KEY:
printf("UP_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(DOWN_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("DOWN_KEY 单击\n");
tft_right();
break;
case D_KEY:
printf("DOWN_KEY 双击\n");
tft_down();
break;
case L_KEY:
printf("DOWN_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(OK_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("OK_KEY 单击\n");
tft_ok();
break;
case D_KEY:
printf("OK_KEY 双击\n");
break;
case L_KEY:
printf("OK_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(RET_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("RET_KEY 单击\n");
tft_ret();
break;
case D_KEY:
printf("RET_KEY 双击\n");
break;
case L_KEY:
printf("RET_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(MR_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("MR_KEY 单击\n");
break;
case D_KEY:
printf("MR_KEY 双击\n");
break;
case L_KEY:
printf("MR_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(MB_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("MB_KEY 单击\n");
break;
case D_KEY:
printf("MB_KEY 双击\n");
break;
case L_KEY:
printf("MB_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(MUVB_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("MUVB_KEY 单击\n");
break;
case D_KEY:
printf("MUVB_KEY 双击\n");
break;
case L_KEY:
printf("MUVB_KEY 长按\n");
break;
default:
break;
}
return;
}
static void manul_key_func(void)
{
/*
*
*/
static uint8_t mlgr, mlgb, mlguvb;
switch (get_key_mean(UP_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("UP_KEY 单击\n");
orient_setspeed(0, ORIENT_LEFT, 100);
break;
case D_KEY:
printf("UP_KEY 双击\n");
orient_setspeed(0, ORIENT_RIGHT, 100);
break;
case L_KEY:
printf("UP_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(DOWN_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("DOWN_KEY 单击\n");
orient_setspeed(1, ORIENT_LEFT, 100);
break;
case D_KEY:
printf("DOWN_KEY 双击\n");
orient_setspeed(1, ORIENT_RIGHT, 100);
break;
case L_KEY:
printf("DOWN_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(OK_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("OK_KEY 单击\n");
break;
case D_KEY:
printf("OK_KEY 双击\n");
break;
case L_KEY:
printf("OK_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(RET_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("RET_KEY 单击\n");
orient_setmode(0, MODE_MANUL);
orient_setmode(1, MODE_MANUL);
break;
case D_KEY:
printf("RET_KEY 双击\n");
break;
case L_KEY:
printf("RET_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(MR_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("MR_KEY 单击\n");
mlgr = !mlgr;
gpio_set(LGRED_PINX, mlgr);
break;
case D_KEY:
printf("MR_KEY 双击\n");
break;
case L_KEY:
printf("MR_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(MB_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("MB_KEY 单击\n");
mlgb = !mlgb;
gpio_set(LGBLUE_PINX, mlgb);
break;
case D_KEY:
printf("MB_KEY 双击\n");
break;
case L_KEY:
printf("MB_KEY 长按\n");
break;
default:
break;
}
switch (get_key_mean(MUVB_KEY))
{
case N_KEY:
//printf("无键\n");
break;
case S_KEY:
printf("MUVB_KEY 单击\n");
mlguvb = !mlguvb;
gpio_set(LGUVB_PINX, mlguvb);
break;
case D_KEY:
printf("MUVB_KEY 双击\n");
break;
case L_KEY:
printf("MUVB_KEY 长按\n");
break;
default:
break;
}
return;
}

View file

@ -139,7 +139,7 @@ void flash_write(uint8_t *saddr, uint16_t nbyte)
*
* flash读取函数的起始地址等于flash写入函数的写入起始地址
*/
void flash_read(uint8_t *daddr, uint8_t nbyte)
void flash_read(uint8_t *daddr, uint16_t nbyte)
{
uint8_t *saddr = (uint8_t *)(flashSSDConfig.PFlashBlockBase + BYTE2WORD(flashSSDConfig.PFlashBlockSize
- (uint32_t)(USED_SECTOR_NUM * FTFx_PSECTOR_SIZE)));

View file

@ -11,7 +11,6 @@
static calendar_info system_time;
enum { START_YEAR = 2000, SEC_IN_DAY = 24 * 60 * 60};
#define DAY_IN_YEAR(nyear) (is_leapyear(nyear) ? 366 : 365)
static const uint8_t day_leap[] = {
@ -182,7 +181,7 @@ void ds1302_read_time(calendar_info *cal)
rval = ds1302_single_read(2);
cal->hour = (rval & 0x0f) + ((rval & 0x30) >> 4) * 10;
rval = ds1302_single_read(3);
cal->mday = (rval & 0x0f) + ((rval & 0x10) >> 4) * 10;
cal->mday = (rval & 0x0f) + ((rval & 0x30) >> 4) * 10;
rval = ds1302_single_read(4);
cal->month = (rval & 0x0f) + ((rval & 0x10) >> 4) * 10;
rval = ds1302_single_read(5);

View file

@ -150,7 +150,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
{ "bg_h", 14, RW_NUM }, { "bg_mi", 0, RW_NUM }, { "ed_h", 14, RW_NUM }, { "ed_mi", 0, RW_NUM }, // 5~8
{ "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", 0, RW_TXT }, // 16~17
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
{ "cnt", 0, R_NUM } //18
}, // 0
{
@ -159,7 +159,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
{ "bg_h", 14, RW_NUM }, { "bg_mi", 0, RW_NUM }, { "ed_h", 14, RW_NUM }, { "ed_mi", 0, RW_NUM }, // 5~8
{ "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", 0, RW_TXT }, // 16~17
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
{ "cnt", 0, R_NUM } //18
}, // 1
{
@ -168,7 +168,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
{ "bg_h", 14, RW_NUM }, { "bg_mi", 0, RW_NUM }, { "ed_h", 14, RW_NUM }, { "ed_mi", 0, RW_NUM }, // 5~8
{ "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", 0, RW_TXT }, // 16~17
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
{ "cnt", 0, R_NUM } //18
}, // 2
{
@ -177,7 +177,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
{ "bg_h", 14, RW_NUM }, { "bg_mi", 0, RW_NUM }, { "ed_h", 14, RW_NUM }, { "ed_mi", 0, RW_NUM }, // 5~8
{ "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", 0, RW_TXT }, // 16~17
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
{ "cnt", 0, R_NUM } //18
}, // 3
{
@ -186,7 +186,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
{ "bg_h", 14, RW_NUM }, { "bg_mi", 0, RW_NUM }, { "ed_h", 14, RW_NUM }, { "ed_mi", 0, RW_NUM }, // 5~8
{ "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", 0, RW_TXT }, // 16~17
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
{ "cnt", 0, R_NUM } //18
}, // 4
{
@ -195,7 +195,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
{ "bg_h", 14, RW_NUM }, { "bg_mi", 0, RW_NUM }, { "ed_h", 14, RW_NUM }, { "ed_mi", 0, RW_NUM }, // 5~8
{ "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", 0, RW_TXT }, // 16~17
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
{ "cnt", 0, R_NUM } //18
}, // 5
{
@ -204,7 +204,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
{ "bg_h", 14, RW_NUM }, { "bg_mi", 0, RW_NUM }, { "ed_h", 14, RW_NUM }, { "ed_mi", 0, RW_NUM }, // 5~8
{ "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", 0, RW_TXT }, // 16~17
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
{ "cnt", 0, R_NUM } //18
}, // 6
{
@ -213,7 +213,7 @@ kv_pair kvp_obj_set[][PLAN_DATA_NUM] =
{ "bg_h", 14, RW_NUM }, { "bg_mi", 0, RW_NUM }, { "ed_h", 14, RW_NUM }, { "ed_mi", 0, RW_NUM }, // 5~8
{ "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", 0, RW_TXT }, // 16~17
{ "x", 0, RW_TXT }, { "y", 1, RW_TXT }, // 16~17
{ "cnt", 0, R_NUM } //18
}, // 7
};
@ -261,6 +261,8 @@ static void tft_set_color(uint8_t etn, tft_colour tft_col)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
sprintf(tft_cmd_str, "%s.bco=%d", kvp_menu[etn].key, tft_col);
tft_send_cmd(tft_cmd_str);
sprintf(tft_cmd_str, "ref %s", kvp_menu[etn].key);
@ -282,6 +284,8 @@ static void tft_set_color(uint8_t etn, tft_colour tft_col)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
sprintf(tft_cmd_str, "%s.bco=%d", kvp_obj_set[tft_stt.objn][etn].key, tft_col);
tft_send_cmd(tft_cmd_str);
sprintf(tft_cmd_str, "ref %s", kvp_obj_set[tft_stt.objn][etn].key);
@ -331,6 +335,8 @@ void tft_up(void)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
case RW_PIC:
case SW_PAGE:
tft_set_color(etn_log, TFT_BACK);
@ -352,6 +358,8 @@ void tft_up(void)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
case RW_PIC:
case SW_PAGE:
tft_set_color(etn_log, TFT_BACK);
@ -391,6 +399,8 @@ void tft_down(void)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
case RW_PIC:
case SW_PAGE:
tft_set_color(etn_log, TFT_BACK);
@ -411,6 +421,8 @@ void tft_down(void)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
case RW_PIC:
case SW_PAGE:
tft_set_color(etn_log, TFT_BACK);
@ -453,6 +465,8 @@ void tft_left(void)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
case RW_PIC:
case SW_PAGE:
tft_set_color(etn_log, TFT_BACK);
@ -474,6 +488,8 @@ void tft_left(void)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
case RW_PIC:
case SW_PAGE:
tft_set_color(etn_log, TFT_BACK);
@ -517,6 +533,8 @@ void tft_right(void)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
case RW_PIC:
case SW_PAGE:
tft_set_color(etn_log, TFT_BACK);
@ -539,6 +557,8 @@ void tft_right(void)
{
case R_NUM:
case RW_NUM:
case R_TXT:
case RW_TXT:
case RW_PIC:
case SW_PAGE:
tft_set_color(etn_log, TFT_BACK);
@ -756,45 +776,29 @@ static void tft_input(void)
break;
case RW_TXT:
tft_set_color(tft_stt.etn, TFT_RED);
in_lmt = tft_input_limit(kvp_obj_set[tft_stt.objn][tft_stt.etn].key);
bg_v = kvp_obj_set[tft_stt.objn][tft_stt.etn].value;
knob_enable();
uint8_t addr = 0;
if (strcmp(kvp_obj_set[tft_stt.objn][tft_stt.etn].key, "x") == 0)
{
addr = 0;
}
else
{
addr = 1;
}
while (get_key_mean(RET_KEY) == N_KEY)
{
in_v = bg_v + get_knob_val();
if (in_v < in_lmt.min)
if (get_key_mean(UP_KEY) == S_KEY)
{
kvp_obj_set[tft_stt.objn][tft_stt.etn].value = in_lmt.min;
bg_v = in_lmt.min;
knob_clear();
orient_setspeed(kvp_obj_set[tft_stt.objn][tft_stt.etn].value, ORIENT_LEFT, 100);
sprintf(tft_cmd_str, "%s.txt=\"%s\"", kvp_obj_set[tft_stt.objn][tft_stt.etn].key,
"左转");
tft_send_cmd(tft_cmd_str);
}
else if (in_v > in_lmt.max)
else if (get_key_mean(DOWN_KEY))
{
kvp_obj_set[tft_stt.objn][tft_stt.etn].value = in_lmt.max;
bg_v = in_lmt.max;
knob_clear();
orient_setspeed(kvp_obj_set[tft_stt.objn][tft_stt.etn].value, ORIENT_RIGHT, 100);
sprintf(tft_cmd_str, "%s.txt=\"%s\"", kvp_obj_set[tft_stt.objn][tft_stt.etn].key,
"右转");
tft_send_cmd(tft_cmd_str);
}
else
{
kvp_obj_set[tft_stt.objn][tft_stt.etn].value = in_v;
// 保持上一次循环
}
sprintf(tft_cmd_str, "%s.txt=\"%d\"", kvp_obj_set[tft_stt.objn][tft_stt.etn].key,
kvp_obj_set[tft_stt.objn][tft_stt.etn].value);
tft_send_cmd(tft_cmd_str);
orient_setspeed(addr, kvp_obj_set[tft_stt.objn][tft_stt.etn].value >= 0 ? ORIENT_RIGHT : ORIENT_LEFT, kvp_obj_set[tft_stt.objn][tft_stt.etn].value);
}
orient_setmode(addr, MODE_MANUL);
knob_disable();
orient_setmode(kvp_obj_set[tft_stt.objn][tft_stt.etn].value, MODE_MANUL); // 手动意为停止
orient_presetop(kvp_obj_set[tft_stt.objn][tft_stt.etn].value, PRESET_SET, tft_stt.objn + 1);
tft_set_color(tft_stt.etn, TFT_PURPLE);
clear_key_m();
break;
@ -843,6 +847,9 @@ void tft_ok(void)
case RW_NUM:
tft_input();
break;
case RW_TXT:
tft_input();
break;
case RW_PIC:
tft_input();
break;
@ -864,6 +871,9 @@ void tft_ok(void)
{
case R_NUM:
break;
case RW_TXT:
tft_input();
break;
case RW_NUM:
tft_input();
break;

View file

@ -18,7 +18,7 @@
* OSCILLATO_50 50MH¾§Õñ
* OSCILLATO_8 8MH¾§Õñ
*/
#define OSCILLATO_8
#define OSCILLATO_50

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,2 @@
[MainWindow]
WindowPlacement=_ 1686 219 2711 745 3
WindowPlacement=_ 139 121 1164 647 3