Rev 298 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 298 | Rev 299 | ||
---|---|---|---|
1 | #include "91x_lib.h" |
1 | #include "91x_lib.h" |
2 | #include "params.h" |
2 | #include "params.h" |
3 | #include "spi_slave.h" |
3 | #include "spi_slave.h" |
4 | #include "waypoints.h" |
4 | #include "waypoints.h" |
5 | 5 | ||
6 | s16 NCParams[255]; |
6 | s16 NCParams[255]; |
7 | u8 NCParamState[255]; |
7 | u8 NCParamState[255]; |
8 | 8 | ||
9 | void NCParams_Init(void) |
9 | void NCParams_Init(void) |
10 | { |
10 | { |
11 | u16 i; |
11 | u16 i; |
12 | for(i=0; i<256; i++) |
12 | for(i=0; i<256; i++) |
13 | { |
13 | { |
14 | NCParamState[i] = NCPARAM_STATE_UNDEFINED; |
14 | NCParamState[i] = NCPARAM_STATE_UNDEFINED; |
15 | NCParams[i] = 0; |
15 | NCParams[i] = 0; |
16 | } |
16 | } |
17 | NCParams[NCPARAMS_GPS_TARGETSPEED] = 50; // 5.0 m/s |
17 | NCParams[NCPARAMS_GPS_TARGETSPEED] = 50; // 5.0 m/s |
18 | NCParams[NCPARAMS_NEW_COMPASS_DIRECTION_SETPOINT] = -1; |
18 | NCParams[NCPARAMS_NEW_COMPASS_DIRECTION_SETPOINT] = -1; |
19 | NCParams[NCPARAMS_ALTITUDE_RATE] = 0; |
19 | NCParams[NCPARAMS_ALTITUDE_RATE] = 0; |
20 | } |
20 | } |
21 | 21 | ||
22 | u8 NCParams_SetValue(u8 id, s16 *pvalue) |
22 | u8 NCParams_SetValue(u8 id, s16 *pvalue) |
23 | { |
23 | { |
24 | NCParams[id] = *pvalue; |
24 | NCParams[id] = *pvalue; |
25 | NCParamState[id] = NCRARAM_STATE_VALID; |
25 | NCParamState[id] = NCRARAM_STATE_VALID; |
26 | 26 | ||
27 | switch(id) |
27 | switch(id) |
28 | { |
28 | { |
29 | case NCPARAMS_NEW_COMPASS_DIRECTION_SETPOINT: |
29 | case NCPARAMS_NEW_COMPASS_DIRECTION_SETPOINT: |
30 | if(NULL == PointList_GetPOI()) |
30 | if(NULL == PointList_GetPOI()) |
31 | { |
31 | { |
32 | CAM_Orientation.Azimuth = *pvalue; |
32 | CAM_Orientation.Azimuth = *pvalue; |
33 | CAM_Orientation.Elevation = 0; |
33 | CAM_Orientation.Elevation = 0; |
34 | CAM_Orientation.UpdateMask = CAM_UPDATE_AZIMUTH; |
34 | CAM_Orientation.UpdateMask = CAM_UPDATE_AZIMUTH; |
35 | } |
35 | } |
36 | break; |
36 | break; |
37 | 37 | ||
38 | default: |
38 | default: |
39 | break; |
39 | break; |
40 | } |
40 | } |
41 | return(NCParamState[id]); |
41 | return(NCParamState[id]); |
42 | } |
42 | } |
43 | 43 | ||
44 | void NCParams_ClearValue(u8 id) |
44 | void NCParams_ClearValue(u8 id) |
45 | { |
45 | { |
46 | NCParamState[id] = NCPARAM_STATE_UNDEFINED; |
46 | NCParamState[id] = NCPARAM_STATE_UNDEFINED; |
47 | } |
47 | } |
48 | 48 | ||
49 | 49 | ||
50 | u8 NCParams_GetValue(u8 id, s16 *pvalue) |
50 | u8 NCParams_GetValue(u8 id, s16 *pvalue) |
51 | { |
51 | { |
52 | if(pvalue == 0) return 0; |
52 | if(pvalue == 0) return 0; |
53 | if(NCParamState[id] == NCRARAM_STATE_VALID) |
53 | if(NCParamState[id] == NCRARAM_STATE_VALID) |
54 | { |
54 | { |
55 | *pvalue = NCParams[id]; |
55 | *pvalue = NCParams[id]; |
56 | } |
56 | } |
57 | return(NCParamState[id]); |
57 | return(NCParamState[id]); |
58 | } |
58 | } |
59 | - | ||
60 | s16 NCParams_GetValue_NoCheck(u8 id) |
- | |
61 | { |
- | |
62 | return(NCParams[id]); |
- | |
63 | } |
59 | |
64 | 60 |