Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 470 → Rev 471

/trunk/gpx.c
273,6 → 273,20
return(retvalue);
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + extended Current measurement -> 200 = 20A 201 = 21A 255 = 75A (20+55)
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
unsigned int BL3_Current(unsigned char who) // in 0,1A
{
if(Motor[who].Current <= 200) return((unsigned int) Motor[who].Current);
else
{
if(Motor_Version[who] & MOTOR_STATE_BL30) return(200 + 10 * (unsigned int) (Motor[who].Current-200));
else return((unsigned int) Motor[who].Current);
}
}
 
 
//________________________________________________________________________________________________________________________________________
// Function: u8 GPX_TrackSegementAddPoint(GPS_Pos_t * pGPS_Position ,GPX_Document_t *doc);
//
406,7 → 420,8
break;
case 5:
// BL Information
sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",Motor[0].Current,Motor[1].Current,Motor[2].Current,Motor[3].Current,Motor[4].Current,Motor[5].Current,Motor[6].Current,Motor[7].Current,Motor[8].Current,Motor[9].Current,Motor[10].Current,Motor[11].Current);
// sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",Motor[0].Current,Motor[1].Current,Motor[2].Current,Motor[3].Current,Motor[4].Current,Motor[5].Current,Motor[6].Current,Motor[7].Current,Motor[8].Current,Motor[9].Current,Motor[10].Current,Motor[11].Current);
sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",BL3_Current(0),BL3_Current(1),BL3_Current(2),BL3_Current(3),BL3_Current(4),BL3_Current(5),BL3_Current(6),BL3_Current(7),BL3_Current(8),BL3_Current(9),BL3_Current(10),BL3_Current(11));
fputs_(string, doc->file);
sprintf(string, "<BL_Temperature>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</BL_Temperature>\r\n",Motor[0].Temperature,Motor[1].Temperature,Motor[2].Temperature,Motor[3].Temperature,Motor[4].Temperature,Motor[5].Temperature,Motor[6].Temperature,Motor[7].Temperature,Motor[8].Temperature,Motor[9].Temperature,Motor[10].Temperature,Motor[11].Temperature);
fputs_(string, doc->file);
472,7 → 487,6
// Navigation Update speed (in 0.1Hz)
// sprintf(string, "<NaviUpdate>%d,%d</NaviUpdate>\r\n",FreqGpsProcessedIn5Sec,FreqNewGpsDataIn5Sec);
// fputs_(string, doc->file);
// RC Received Signal Strength Indication
// eof extensions
sprintf(string, "</extensions>\r\n");
fputs_(string, doc->file);
/trunk/gpx.h
32,5 → 32,6
u8 GPX_TrackSegmentBegin(GPX_Document_t *doc); // begins a new tracksegment within the actual track
u8 GPX_TrackSegmentEnd(GPX_Document_t *doc); // ends the actual track segment within the actual track
u8 GPX_TrackSegmentAddPoint(GPX_Document_t *,unsigned char part); // adds a point to the tracksegment
extern unsigned int BL3_Current(unsigned char who); // in 0,1A
 
#endif //_GPX_H
/trunk/menu.c
68,6 → 68,7
#include "ncmag.h"
#include "logging.h"
#include "settings.h"
#include "gpx.h"
 
u8 DispPtr = 0;
s8 DisplayBuff[DISPLAYBUFFSIZE];
74,7 → 75,7
 
 
u8 MenuItem = 0;
u8 MaxMenuItem = 21;
u8 MaxMenuItem = 22;
 
void Menu_Putchar(char c)
{
447,6 → 448,16
if(FreqNewGpsDataIn5Sec >= 48 && FreqNewGpsDataIn5Sec <= 52) LCD_printfxy(18,2,"OK") else LCD_printfxy(18,2,"!!");
if(FreqGpsProcessedIn5Sec >= 350) LCD_printfxy(18,3,"OK") else LCD_printfxy(18,3,"!!");
break;
case 22:
LCD_printfxy(0,0,"BL Current" );
LCD_printfxy(11,3,"(in 0.1A)" );
for(i1 = 0; i1 < 3; i1++)
{
LCD_printfxy(0,i1+1,"%3d %3d %3d %3d ",BL3_Current(i1*4),BL3_Current(i1*4+1),BL3_Current(i1*4+2),BL3_Current(i1*4+3));
if(Motor[4 + i1 * 4].State == 0) break;
}
 
break;
default:
//MaxMenuItem = MenuItem - 1;
MenuItem = 0;
/trunk/menu.h
21,7 → 21,7
void Menu_Clear(void);
void Menu_Putchar(char c);
 
#define LCD_printfxy(x,y,format, args...) { DispPtr = y * 20 + x; _printf_P(&Menu_Putchar, format , ## args);}
#define LCD_printfxy(x,y,format, args...) { DispPtr = (y) * 20 + (x); _printf_P(&Menu_Putchar, format , ## args);}
#define LCD_printf(format, args...) { _printf_P(&Menu_Putchar, format , ## args);}
 
 
/trunk/spi_slave.c
117,6 → 117,7
u8 FCCalibActive = 0;
u8 FC_is_Calibrated = 0;
Motor_t Motor[12];
u8 Motor_Version[12]; // das kann nicht in die struct, weil der PC die Struktur bekommt
u8 NC_To_FC_Flags = 0;
u8 BL_MinOfMaxPWM; // indication if all BL-controllers run on full power
u32 FC_I2C_ErrorConter;
604,8 → 605,8
HeadFreeStartAngle = GyroCompassCorrected; // in 0.1°
}
}
 
Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
FC.BAT_Voltage = FromFlightCtrl.Param.Byte[10];
DebugOut.Analog[5] = FC.StatusFlags;
NaviData.FCStatusFlags = FC.StatusFlags;
if(FC.StatusFlags2 & FC_STATUS2_WAIT_FOR_TAKEOFF) NaviData.FCStatusFlags &= ~FC_STATUS_FLY;
622,19 → 623,18
 
Logging_FCStatusFlags1 |= FC.StatusFlags;
Logging_FCStatusFlags2 |= FC.StatusFlags2;
Parameter.ComingHomeAltitude = FromFlightCtrl.Param.Byte[10];
break;
 
case SPI_FCCMD_BL_ACCU:
FC.BAT_Current = FromFlightCtrl.Param.Int[0];
FC.BAT_UsedCapacity = FromFlightCtrl.Param.Int[1];
FC.BAT_Voltage = FromFlightCtrl.Param.Byte[4];
Parameter.NaviGpsModeControl = FromFlightCtrl.Param.Byte[5];
FromFC_VarioCharacter = FromFlightCtrl.Param.Byte[6];
Motor[FromFlightCtrl.Param.Byte[7]].MaxPWM = FromFlightCtrl.Param.Byte[8];
Motor[FromFlightCtrl.Param.Byte[7]].State = FromFlightCtrl.Param.Byte[9];
Motor[FromFlightCtrl.Param.Byte[7]].Temperature = FromFlightCtrl.Param.Byte[10];
Motor[FromFlightCtrl.Param.Byte[7]].Current = FromFlightCtrl.Param.Byte[11];
Parameter.NaviGpsModeControl = FromFlightCtrl.Param.Byte[4];
FromFC_VarioCharacter = FromFlightCtrl.Param.Byte[5];
Motor_Version[FromFlightCtrl.Param.Byte[6]] = FromFlightCtrl.Param.Byte[7];
Motor[FromFlightCtrl.Param.Byte[6]].MaxPWM = FromFlightCtrl.Param.Byte[8];
Motor[FromFlightCtrl.Param.Byte[6]].State = FromFlightCtrl.Param.Byte[9];
Motor[FromFlightCtrl.Param.Byte[6]].Temperature = FromFlightCtrl.Param.Byte[10];
Motor[FromFlightCtrl.Param.Byte[6]].Current = FromFlightCtrl.Param.Byte[11];
if(FromFC_VarioCharacter == '+' || FromFC_VarioCharacter == '-') // manual setpoint clears the NC-Parameter command
{
NCParams_ClearValue(NCPARAMS_ALTITUDE_RATE);
661,6 → 661,7
CHK_POTI_MM(Parameter.NaviOut1Parameter,FromFlightCtrl.Param.Byte[0],0,255);
if(FromFlightCtrl.Param.Byte[1]) FC.FromFC_SpeakHoTT = FromFlightCtrl.Param.Byte[1]; // will be cleared in the SD-Logging
Parameter.FromFC_LandingSpeed = FromFlightCtrl.Param.Byte[2];
Parameter.ComingHomeAltitude = FromFlightCtrl.Param.Byte[3];
break;
case SPI_FCCMD_STICK:
FC.StickGas = FromFlightCtrl.Param.sByte[0];
/trunk/spi_slave.h
141,6 → 141,14
 
extern Motor_t Motor[12];
 
 
//Motor_Version[12]
#define MOTOR_STATE_NEW_PROTOCOL_MASK 0x01
#define MOTOR_STATE_FAST_MODE 0x02
#define MOTOR_STATE_BL30 0x04 // extended Current measurement -> 200 = 20A 201 = 21A 255 = 75A (20+55)
extern unsigned char Motor_Version[12]; // das kann nicht in die struct, weil der PC die Struktur bekommt
 
 
typedef struct
{
u8 Major;