/trunk/params.c |
---|
9,13 → 9,15 |
NCParams[NCPARAMS_GPS_TARGETSPEED] = 50; // 5.0 m/s |
} |
u8 NCParams_SetValue(u8 id, s16 value) |
u8 NCParams_SetValue(u8 id, s16* pvalue) |
{ |
NCParams[id] = value; |
NCParams[id] = *pvalue; |
return 1; |
} |
s16 NCParams_GetValue(u8 id) |
u8 NCParams_GetValue(u8 id, s16* pvalue) |
{ |
return NCParams[id]; |
if(pvalue == 0) return 0; |
*pvalue = NCParams[id]; |
return 1; |
} |
/trunk/params.h |
---|
5,7 → 5,7 |
#define NCPARAMS_GPS_TARGETSPEED 0 |
extern void NCParams_Init(); |
extern u8 NCParams_SetValue(u8 id, s16 value); |
extern s16 NCParams_GetValue(u8 id); |
extern u8 NCParams_SetValue(u8 id, s16* pvalue); |
extern u8 NCParams_GetValue(u8 id, s16* pvalue); |
#endif // _PARAMS_H |
/trunk/uart1.c |
---|
441,7 → 441,7 |
break; |
case 1: // set |
NCParams_SetValue(SerialMsg.pData[1], *(s16*)(&SerialMsg.pData[2])); |
NCParams_SetValue(SerialMsg.pData[1], (s16*)(&SerialMsg.pData[2])); |
break; |
default: |
577,7 → 577,7 |
if(UART1_Request_Parameter && (UART1_tx_buffer.Locked == FALSE)) |
{ |
s16 ParamValue; |
ParamValue = NCParams_GetValue(UART1_Request_ParameterId); |
NCParams_GetValue(UART1_Request_ParameterId, &ParamValue); |
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'P', NC_ADDRESS, 2, &UART1_Request_ParameterId, sizeof(UART1_Request_ParameterId), &ParamValue, sizeof(ParamValue)); // answer the param request |
UART1_Request_Parameter = FALSE; |
} |