Subversion Repositories NaviCtrl

Rev

Rev 588 | 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
        {
588 holgerb 29
                case NCPARAMS_FORCE_NEW_COMPASS_DIRECTION:
30
                        CAM_Orientation.UpdateMask |= FORCE_AZIMUTH_ROTATION;
31
                        // Break fehlt hier absichtlich
278 killagreg 32
                case NCPARAMS_NEW_COMPASS_DIRECTION_SETPOINT:
280 killagreg 33
                    if(NULL == PointList_GetPOI())
278 killagreg 34
                        {
35
                                CAM_Orientation.Azimuth = *pvalue;
36
                                CAM_Orientation.Elevation = 0;
588 holgerb 37
                                CAM_Orientation.UpdateMask |= CAM_UPDATE_AZIMUTH;
278 killagreg 38
                        }
39
                        break;
40
                default:
41
                        break;
42
        }
298 holgerb 43
        return(NCParamState[id]);
156 killagreg 44
}
45
 
298 holgerb 46
void NCParams_ClearValue(u8 id)
156 killagreg 47
{
298 holgerb 48
        NCParamState[id] =      NCPARAM_STATE_UNDEFINED;
49
}
50
 
51
 
52
u8 NCParams_GetValue(u8 id, s16 *pvalue)
53
{
157 killagreg 54
        if(pvalue == 0) return 0;
295 killagreg 55
        if(NCParamState[id] == NCRARAM_STATE_VALID)
56
        {
57
                *pvalue = NCParams[id];
58
        }
298 holgerb 59
        return(NCParamState[id]);
156 killagreg 60
}
298 holgerb 61