添加了半成品的浇水部分,没有实际作用,目前浇水功能直接用硬件实现;

加入了对毕设论文的记录;
This commit is contained in:
forbelief 2016-05-24 22:24:07 +08:00
parent 3b6408a650
commit fe11958be3
17 changed files with 6973 additions and 6919 deletions

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -1906,9 +1906,6 @@
<file> <file>
<name>$PROJ_DIR$\..\src\app\include\debug.h</name> <name>$PROJ_DIR$\..\src\app\include\debug.h</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\src\app\include\input.h</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\src\app\include\isr.h</name> <name>$PROJ_DIR$\..\src\app\include\isr.h</name>
</file> </file>
@ -1948,13 +1945,13 @@
<file> <file>
<name>$PROJ_DIR$\..\src\app\include\tft_plan_internal.h</name> <name>$PROJ_DIR$\..\src\app\include\tft_plan_internal.h</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\src\app\include\water.h</name>
</file>
</group> </group>
<file> <file>
<name>$PROJ_DIR$\..\src\app\debug.c</name> <name>$PROJ_DIR$\..\src\app\debug.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\src\app\input.c</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\src\app\isr.c</name> <name>$PROJ_DIR$\..\src\app\isr.c</name>
</file> </file>
@ -1991,6 +1988,9 @@
<file> <file>
<name>$PROJ_DIR$\..\src\app\tft.c</name> <name>$PROJ_DIR$\..\src\app\tft.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\src\app\water.c</name>
</file>
</group> </group>
<group> <group>
<name>common</name> <name>common</name>

View file

@ -182,9 +182,6 @@
<file> <file>
<name>$PROJ_DIR$\..\src\app\include\debug.h</name> <name>$PROJ_DIR$\..\src\app\include\debug.h</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\src\app\include\input.h</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\src\app\include\isr.h</name> <name>$PROJ_DIR$\..\src\app\include\isr.h</name>
</file> </file>
@ -224,13 +221,13 @@
<file> <file>
<name>$PROJ_DIR$\..\src\app\include\tft_plan_internal.h</name> <name>$PROJ_DIR$\..\src\app\include\tft_plan_internal.h</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\src\app\include\water.h</name>
</file>
</group> </group>
<file> <file>
<name>$PROJ_DIR$\..\src\app\debug.c</name> <name>$PROJ_DIR$\..\src\app\debug.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\src\app\input.c</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\src\app\isr.c</name> <name>$PROJ_DIR$\..\src\app\isr.c</name>
</file> </file>
@ -267,6 +264,9 @@
<file> <file>
<name>$PROJ_DIR$\..\src\app\tft.c</name> <name>$PROJ_DIR$\..\src\app\tft.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\src\app\water.c</name>
</file>
</group> </group>
<group> <group>
<name>common</name> <name>common</name>

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@ TriggerName=main
LimitSize=0 LimitSize=0
ByteLimit=50 ByteLimit=50
[DebugChecksum] [DebugChecksum]
Checksum=-253352013 Checksum=231404021
[CodeCoverage] [CodeCoverage]
Enabled=_ 0 Enabled=_ 0
[Exceptions] [Exceptions]
@ -52,12 +52,6 @@ ITMportsEnable=0
ITMportsTermIO=0 ITMportsTermIO=0
ITMportsLogFile=0 ITMportsLogFile=0
ITMlogFile=$PROJ_DIR$\ITM.log ITMlogFile=$PROJ_DIR$\ITM.log
[Trace1]
Enabled=0
ShowSource=1
[Trace2]
Enabled=0
ShowSource=0
[SWOTraceWindow] [SWOTraceWindow]
PcSampling=0 PcSampling=0
InterruptLogs=0 InterruptLogs=0
@ -96,13 +90,6 @@ GraphEnabled=0
ShowTimeLog=1 ShowTimeLog=1
ShowTimeSum=1 ShowTimeSum=1
SumSortOrder=0 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] [Log file]
LoggingEnabled=_ 0 LoggingEnabled=_ 0
LogFile=_ "" LogFile=_ ""
@ -110,9 +97,6 @@ Category=_ 0
[TermIOLog] [TermIOLog]
LoggingEnabled=_ 0 LoggingEnabled=_ 0
LogFile=_ "" LogFile=_ ""
[Aliases]
Count=0
SuppressDialog=0
[CallStackLog] [CallStackLog]
Enabled=0 Enabled=0
[PowerProbe] [PowerProbe]
@ -125,3 +109,10 @@ Mode=1
Graph=0 Graph=0
Symbiont=0 Symbiont=0
Exclusions= Exclusions=
[Disassemble mode]
mode=0
[Breakpoints2]
Count=0
[Aliases]
Count=0
SuppressDialog=0

View file

@ -48,6 +48,8 @@
#define KNOB_B_PINX PTD6 #define KNOB_B_PINX PTD6
#define KNOB_KEY_PINX PTE20 #define KNOB_KEY_PINX PTE20
#define MOISTURE_ADC0_CHN ADC0_DP1 // PTE16
/* /*

View file

@ -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

View 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 */

View file

@ -36,8 +36,6 @@ void main(void)
knob_enable(); knob_enable();
while (1) while (1)
{ {
/* /*
@ -84,15 +82,6 @@ void main(void)
st.year, st.month, st.wday, st.mday, st.year, st.month, st.wday, st.mday,
st.hour, st.min, st.sec); st.hour, st.min, st.sec);
printf("sec = %d\n", calendar_to_sec(&st)); 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; static uint8_t lg_test;
lg_test = !lg_test; lg_test = !lg_test;

View file

@ -94,6 +94,10 @@
/*
* tft_state - tft操作中
* pgn表示页面编号etnln分别一个页面中的元素号objn表示元素号
*/
typedef struct tft_state_ typedef struct tft_state_
{ {
uint8_t pgn; uint8_t pgn;
@ -892,12 +896,16 @@ void tft_ok(void)
return; return;
} }
/*
* tft_page_refresh() -
*/
void tft_page_refresh(void) void tft_page_refresh(void)
{ {
switch (tft_stt.pgn) switch (tft_stt.pgn)
{ {
case ORIGINAL_PG: 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) switch (SW_PAGE)
{ {
@ -915,7 +923,8 @@ void tft_page_refresh(void)
} }
break; break;
case MENU_PG: 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) switch (kvp_menu[etn].attr)
{ {
@ -940,16 +949,19 @@ void tft_page_refresh(void)
} }
break; break;
case OBJ_SET_PG: 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) switch (kvp_obj_set[tft_stt.objn][etn].attr)
{ {
case R_NUM: case R_NUM:
case RW_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); kvp_obj_set[tft_stt.objn][etn].value);
tft_send_cmd(tft_cmd_str); 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); tft_send_cmd(tft_cmd_str);
break; break;
case RW_PIC: case RW_PIC:

View 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

View file

@ -1,2 +1,2 @@
[MainWindow] [MainWindow]
WindowPlacement=_ 1494 249 2519 775 3 WindowPlacement=_ 125 87 1150 613 2