添加了半成品的浇水部分,没有实际作用,目前浇水功能直接用硬件实现;
加入了对毕设论文的记录;
This commit is contained in:
parent
3b6408a650
commit
fe11958be3
17 changed files with 6973 additions and 6919 deletions
BIN
plan_manage_main/doc/宋星_毕设论文.docx
Normal file
BIN
plan_manage_main/doc/宋星_毕设论文.docx
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
|
@ -1906,9 +1906,6 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\debug.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\input.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\isr.h</name>
|
||||
</file>
|
||||
|
|
@ -1948,13 +1945,13 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\tft_plan_internal.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\water.h</name>
|
||||
</file>
|
||||
</group>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\debug.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\input.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\isr.c</name>
|
||||
</file>
|
||||
|
|
@ -1991,6 +1988,9 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\tft.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\water.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>common</name>
|
||||
|
|
|
|||
|
|
@ -182,9 +182,6 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\debug.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\input.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\isr.h</name>
|
||||
</file>
|
||||
|
|
@ -224,13 +221,13 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\tft_plan_internal.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\include\water.h</name>
|
||||
</file>
|
||||
</group>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\debug.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\input.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\isr.c</name>
|
||||
</file>
|
||||
|
|
@ -267,6 +264,9 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\tft.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\src\app\water.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>common</name>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,7 +9,7 @@ TriggerName=main
|
|||
LimitSize=0
|
||||
ByteLimit=50
|
||||
[DebugChecksum]
|
||||
Checksum=-253352013
|
||||
Checksum=231404021
|
||||
[CodeCoverage]
|
||||
Enabled=_ 0
|
||||
[Exceptions]
|
||||
|
|
@ -52,12 +52,6 @@ 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
|
||||
|
|
@ -96,13 +90,6 @@ GraphEnabled=0
|
|||
ShowTimeLog=1
|
||||
ShowTimeSum=1
|
||||
SumSortOrder=0
|
||||
[Disassemble mode]
|
||||
mode=0
|
||||
[Breakpoints2]
|
||||
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=_ ""
|
||||
|
|
@ -110,9 +97,6 @@ Category=_ 0
|
|||
[TermIOLog]
|
||||
LoggingEnabled=_ 0
|
||||
LogFile=_ ""
|
||||
[Aliases]
|
||||
Count=0
|
||||
SuppressDialog=0
|
||||
[CallStackLog]
|
||||
Enabled=0
|
||||
[PowerProbe]
|
||||
|
|
@ -125,3 +109,10 @@ Mode=1
|
|||
Graph=0
|
||||
Symbiont=0
|
||||
Exclusions=
|
||||
[Disassemble mode]
|
||||
mode=0
|
||||
[Breakpoints2]
|
||||
Count=0
|
||||
[Aliases]
|
||||
Count=0
|
||||
SuppressDialog=0
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@
|
|||
#define KNOB_B_PINX PTD6
|
||||
#define KNOB_KEY_PINX PTE20
|
||||
|
||||
#define MOISTURE_ADC0_CHN ADC0_DP1 // PTE16
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* 文件:input.h
|
||||
* 功能:将外设输入的数据转换为单片机内存中的数据
|
||||
*/
|
||||
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
|
||||
|
||||
typedef struct InData_
|
||||
{
|
||||
uint8_t isWifiOn : 1;
|
||||
uint8_t isPlanMode : 1;
|
||||
|
||||
uint8_t isRedL : 1;
|
||||
uint8_t isBlueL : 1;
|
||||
uint8_t isUvbL : 1;
|
||||
|
||||
uint8_t knobV;
|
||||
} InData;
|
||||
|
||||
|
||||
void InitInput(void);
|
||||
|
||||
void
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // INPUT_H
|
||||
32
plan_manage_main/src/app/include/water.h
Normal file
32
plan_manage_main/src/app/include/water.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* water.h - ½½Ë®
|
||||
*/
|
||||
|
||||
|
||||
#ifndef WARER_H
|
||||
#define WARER_H
|
||||
|
||||
|
||||
#define MOISTURE_RATIO 0.1
|
||||
#define MOISTURE_MIN 1
|
||||
|
||||
|
||||
|
||||
|
||||
void water_init(void);
|
||||
|
||||
|
||||
uint16_t get_moisture(void);
|
||||
|
||||
|
||||
void water_ctr(uint16_t sv_moist);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* WARER_H */
|
||||
|
|
@ -36,8 +36,6 @@ void main(void)
|
|||
knob_enable();
|
||||
|
||||
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
/*
|
||||
|
|
@ -84,15 +82,6 @@ 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 = 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);
|
||||
|
||||
static uint8_t lg_test;
|
||||
lg_test = !lg_test;
|
||||
|
|
|
|||
|
|
@ -94,6 +94,10 @@
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* tft_state - 在tft操作中,表示当前状态机的状态的类型
|
||||
* pgn表示页面编号,etn、ln分别一个页面中的元素号、行号,objn表示元素号。
|
||||
*/
|
||||
typedef struct tft_state_
|
||||
{
|
||||
uint8_t pgn;
|
||||
|
|
@ -892,12 +896,16 @@ void tft_ok(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* tft_page_refresh() - 在页面信息有改变时调用以刷新页面
|
||||
*/
|
||||
void tft_page_refresh(void)
|
||||
{
|
||||
switch (tft_stt.pgn)
|
||||
{
|
||||
case ORIGINAL_PG:
|
||||
for (uint8_t etn = 0; etn < sizeof(kvp_original) / sizeof(kv_pair); etn++)
|
||||
for (uint8_t etn = 0; etn < sizeof(kvp_original) / sizeof(kv_pair);
|
||||
etn++)
|
||||
{
|
||||
switch (SW_PAGE)
|
||||
{
|
||||
|
|
@ -915,7 +923,8 @@ void tft_page_refresh(void)
|
|||
}
|
||||
break;
|
||||
case MENU_PG:
|
||||
for (int etn = 0; etn < sizeof(kvp_menu) / sizeof(kv_pair); etn++)
|
||||
for (int etn = 0; etn < sizeof(kvp_menu) / sizeof(kv_pair);
|
||||
etn++)
|
||||
{
|
||||
switch (kvp_menu[etn].attr)
|
||||
{
|
||||
|
|
@ -940,16 +949,19 @@ void tft_page_refresh(void)
|
|||
}
|
||||
break;
|
||||
case OBJ_SET_PG:
|
||||
for (int etn = 0; etn < sizeof(kvp_obj_set[0]) / sizeof(kv_pair); etn++)
|
||||
for (int etn = 0; etn < sizeof(kvp_obj_set[0]) / sizeof(kv_pair);
|
||||
etn++)
|
||||
{
|
||||
switch (kvp_obj_set[tft_stt.objn][etn].attr)
|
||||
{
|
||||
case R_NUM:
|
||||
case RW_NUM:
|
||||
sprintf(tft_cmd_str, "%s.val=%d", kvp_obj_set[tft_stt.objn][etn].key,
|
||||
sprintf(tft_cmd_str, "%s.val=%d",
|
||||
kvp_obj_set[tft_stt.objn][etn].key,
|
||||
kvp_obj_set[tft_stt.objn][etn].value);
|
||||
tft_send_cmd(tft_cmd_str);
|
||||
sprintf(tft_cmd_str, "ref %s", kvp_obj_set[tft_stt.objn][etn].key);
|
||||
sprintf(tft_cmd_str, "ref %s",
|
||||
kvp_obj_set[tft_stt.objn][etn].key);
|
||||
tft_send_cmd(tft_cmd_str);
|
||||
break;
|
||||
case RW_PIC:
|
||||
|
|
|
|||
41
plan_manage_main/src/app/water.c
Normal file
41
plan_manage_main/src/app/water.c
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "adc.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "water.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void water_init(void)
|
||||
{
|
||||
gpio_init(WATER_PINX, 1, 1);
|
||||
adc_init(MOISTURE_ADC0_CHN);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint16_t get_moisture(void)
|
||||
{
|
||||
uint16_t res;
|
||||
|
||||
res = adc_ave(MOISTURE_ADC0_CHN, ADC_16bit, 3);
|
||||
return (uint16_t)((float)res / 0xffff * MOISTURE_RATIO + MOISTURE_MIN);
|
||||
}
|
||||
|
||||
void water_ctr(uint16_t sv_moist)
|
||||
{
|
||||
uint16_t crt_moist = get_moisture();
|
||||
|
||||
if (sv_moist > crt_moist)
|
||||
{
|
||||
gpio_set(WATER_PINX, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_set(WATER_PINX, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,2 +1,2 @@
|
|||
[MainWindow]
|
||||
WindowPlacement=_ 1494 249 2519 775 3
|
||||
WindowPlacement=_ 125 87 1150 613 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue