Subversion Repositories NaviCtrl

Rev

Rev 494 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
156 killagreg 1
#include "91x_lib.h"
2
#include "params.h"
276 holgerb 3
#include "spi_slave.h"
278 killagreg 4
#include "waypoints.h"
156 killagreg 5
 
6
s16 NCParams[255];
295 killagreg 7
u8 NCParamState[255];
156 killagreg 8
 
9
void NCParams_Init(void)
10
{
295 killagreg 11
        u16 i;
12
        for(i=0; i<256; i++)
13
        {
14
                NCParamState[i] = NCPARAM_STATE_UNDEFINED;
298 holgerb 15
                NCParams[i] = 0;
295 killagreg 16
        }
156 killagreg 17
        NCParams[NCPARAMS_GPS_TARGETSPEED] = 50; // 5.0 m/s
276 holgerb 18
        NCParams[NCPARAMS_NEW_COMPASS_DIRECTION_SETPOINT] = -1;
298 holgerb 19
        NCParams[NCPARAMS_ALTITUDE_RATE] = 0;
156 killagreg 20
}
21
 
298 holgerb 22
u8 NCParams_SetValue(u8 id, s16 *pvalue)
156 killagreg 23
{
157 killagreg 24
        NCParams[id] = *pvalue;
295 killagreg 25
        NCParamState[id] =      NCRARAM_STATE_VALID;
278 killagreg 26
 
27
        switch(id)
28
        {
29
                case NCPARAMS_NEW_COMPASS_DIRECTION_SETPOINT:
280 killagreg 30
                    if(NULL == PointList_GetPOI())
278 killagreg 31
                        {
32
                                CAM_Orientation.Azimuth = *pvalue;
33
                                CAM_Orientation.Elevation = 0;
280 killagreg 34
                                CAM_Orientation.UpdateMask = CAM_UPDATE_AZIMUTH;
278 killagreg 35
                        }
36
                        break;
37
 
38
                default:
39
                        break;
40
        }
298 holgerb 41
        return(NCParamState[id]);
156 killagreg 42
}
43
 
298 holgerb 44
void NCParams_ClearValue(u8 id)
156 killagreg 45
{
298 holgerb 46
        NCParamState[id] =      NCPARAM_STATE_UNDEFINED;
47
}
48
 
49
 
50
u8 NCParams_GetValue(u8 id, s16 *pvalue)
51
{
157 killagreg 52
        if(pvalue == 0) return 0;
295 killagreg 53
        if(NCParamState[id] == NCRARAM_STATE_VALID)
54
        {
55
                *pvalue = NCParams[id];
56
        }
298 holgerb 57
        return(NCParamState[id]);
156 killagreg 58
}
298 holgerb 59