Permalink
Browse files

Fixing bad warnings

  • Loading branch information...
1 parent 0edd698 commit 9784823d96f7d98f2855433a7f605157db1b543e @Zuph Zuph committed Feb 19, 2012
Showing with 86 additions and 84 deletions.
  1. +1 −1 Makefile
  2. +11 −11 comm/outputParse.c
  3. +33 −33 lib/bmp085.c
  4. +3 −3 lib/tmp100.c
  5. +24 −24 main.c
  6. +4 −4 parsing/epoch.c
  7. +10 −8 parsing/gps.c
View
@@ -123,7 +123,7 @@ CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
-CFLAGS += -Wall -Wstrict-prototypes
+CFLAGS += -Wall -Wstrict-prototypes -Wno-unused-variable
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
View
@@ -141,7 +141,7 @@ uint16_t getTxSample(uint8_t *output, uint32_t *bitmask, uint16_t sampleNumber,
//lprintf("P: %lx\n", reversedBitmask[0]);
//lprintf("P: %lx\n", reversedBitmask[1]);
//lprintf("P: %lx\n", reversedBitmask[2]);
- if(reversedBitmask[currentTelemetryChannel/32] & 1 == 1)
+ if((reversedBitmask[currentTelemetryChannel/32] & 1) == 1)
{
//lprintf("Tof: %d\n", pgm_read_byte(&bitmaskTypeOrder[currentTelemetryChannel]));
//lprintf("Tok: %s\n", token);
@@ -151,7 +151,7 @@ uint16_t getTxSample(uint8_t *output, uint32_t *bitmask, uint16_t sampleNumber,
uint32_t holder32;
float holderf;
case 8:
- sscanf(token, "%d", &output[bytesWritten]);
+ sscanf(token, "%d", (int *)&output[bytesWritten]);
bytesWritten+=1;
break;
case 16:
@@ -268,22 +268,22 @@ void flushSatQueue(void)
lprintf_P(PSTR("CPS: %x %x CPE: %x %x\n"), cps1, cps2, cpe1, cpe2);
#endif
- i2cSendStart();
- i2cWaitForComplete();
- i2cSendByte(0x10);
- i2cWaitForComplete();
- i2cSendByte(0x01);
+ i2cSendStart();
+ i2cWaitForComplete();
+ i2cSendByte(0x10);
+ i2cWaitForComplete();
+ i2cSendByte(0x01);
i2cWaitForComplete();
- i2cSendByte(cps1);
+ i2cSendByte(cps1);
i2cWaitForComplete();
- i2cSendByte(cps2);
+ i2cSendByte(cps2);
i2cWaitForComplete();
- i2cSendByte(cpe1);
+ i2cSendByte(cpe1);
i2cWaitForComplete();
i2cSendByte(cpe2);
i2cWaitForComplete();
-
+
i2cSendStop();
#ifdef opdebug
View
@@ -27,32 +27,32 @@
#include "bmp085.h"
//Needed for BMP085
-extern short EEMEM EEBMPac1;
-extern short EEMEM EEBMPac2;
-extern short EEMEM EEBMPac3;
-extern unsigned short EEMEM EEBMPac4;
-extern unsigned short EEMEM EEBMPac5;
-extern unsigned short EEMEM EEBMPac6;
-extern short EEMEM EEBMPb1;
-extern short EEMEM EEBMPb2;
-extern short EEMEM EEBMPmb;
-extern short EEMEM EEBMPmc;
-extern short EEMEM EEBMPmd;
+extern int16_t EEMEM EEBMPac1;
+extern int16_t EEMEM EEBMPac2;
+extern int16_t EEMEM EEBMPac3;
+extern uint16_t EEMEM EEBMPac4;
+extern uint16_t EEMEM EEBMPac5;
+extern uint16_t EEMEM EEBMPac6;
+extern int16_t EEMEM EEBMPb1;
+extern int16_t EEMEM EEBMPb2;
+extern int16_t EEMEM EEBMPmb;
+extern int16_t EEMEM EEBMPmc;
+extern int16_t EEMEM EEBMPmd;
void BMP085_Calibration(void)
{
- eeprom_write_word(&EEBMPac1, bmp085ReadShort(0xAA));
- eeprom_write_word(&EEBMPac2, bmp085ReadShort(0xAC));
- eeprom_write_word(&EEBMPac3, bmp085ReadShort(0xAE));
- eeprom_write_word(&EEBMPac4, bmp085ReadShort(0xB0));
- eeprom_write_word(&EEBMPac5, bmp085ReadShort(0xB2));
- eeprom_write_word(&EEBMPac6, bmp085ReadShort(0xB4));
- eeprom_write_word(&EEBMPb1, bmp085ReadShort(0xB6));
- eeprom_write_word(&EEBMPb2, bmp085ReadShort(0xB8));
- eeprom_write_word(&EEBMPmb, bmp085ReadShort(0xBA));
- eeprom_write_word(&EEBMPmc, bmp085ReadShort(0xBC));
- eeprom_write_word(&EEBMPmd, bmp085ReadShort(0xBE));
+ eeprom_write_word((uint16_t *)&EEBMPac1, bmp085ReadShort(0xAA));
+ eeprom_write_word((uint16_t *)&EEBMPac2, bmp085ReadShort(0xAC));
+ eeprom_write_word((uint16_t *)&EEBMPac3, bmp085ReadShort(0xAE));
+ eeprom_write_word((uint16_t *)&EEBMPac4, bmp085ReadShort(0xB0));
+ eeprom_write_word((uint16_t *)&EEBMPac5, bmp085ReadShort(0xB2));
+ eeprom_write_word((uint16_t *)&EEBMPac6, bmp085ReadShort(0xB4));
+ eeprom_write_word((uint16_t *)&EEBMPb1, bmp085ReadShort(0xB6));
+ eeprom_write_word((uint16_t *)&EEBMPb2, bmp085ReadShort(0xB8));
+ eeprom_write_word((uint16_t *)&EEBMPmb, bmp085ReadShort(0xBA));
+ eeprom_write_word((uint16_t *)&EEBMPmc, bmp085ReadShort(0xBC));
+ eeprom_write_word((uint16_t *)&EEBMPmd, bmp085ReadShort(0xBE));
}
@@ -172,17 +172,17 @@ void bmp085Convert(long* temperature, long* pressure)
short md;
//End Globals
- ac1 = eeprom_read_word(&EEBMPac1);
- ac2 = eeprom_read_word(&EEBMPac2);
- ac3 = eeprom_read_word(&EEBMPac3);
- ac4 = eeprom_read_word(&EEBMPac4);
- ac5 = eeprom_read_word(&EEBMPac5);
- ac6 = eeprom_read_word(&EEBMPac6);
- b1 = eeprom_read_word(&EEBMPb1);
- b2 = eeprom_read_word(&EEBMPb2);
- mb = eeprom_read_word(&EEBMPmb);
- mc = eeprom_read_word(&EEBMPmc);
- md = eeprom_read_word(&EEBMPmd);
+ ac1 = eeprom_read_word((uint16_t *)&EEBMPac1);
+ ac2 = eeprom_read_word((uint16_t *)&EEBMPac2);
+ ac3 = eeprom_read_word((uint16_t *)&EEBMPac3);
+ ac4 = eeprom_read_word((uint16_t *)&EEBMPac4);
+ ac5 = eeprom_read_word((uint16_t *)&EEBMPac5);
+ ac6 = eeprom_read_word((uint16_t *)&EEBMPac6);
+ b1 = eeprom_read_word((uint16_t *)&EEBMPb1);
+ b2 = eeprom_read_word((uint16_t *)&EEBMPb2);
+ mb = eeprom_read_word((uint16_t *)&EEBMPmb);
+ mc = eeprom_read_word((uint16_t *)&EEBMPmc);
+ md = eeprom_read_word((uint16_t *)&EEBMPmd);
//This code is modified from Sparkfun's Example code
unsigned long ut;
View
@@ -22,7 +22,7 @@
uint16_t tmp100rawTemp(uint8_t address)
{
- uint16_t error;
+ uint16_t error = 0;
i2cDisableInt();
@@ -94,7 +94,7 @@ uint8_t getTMP100config(uint8_t address)
uint8_t setTMP100config(uint8_t address, uint8_t data)
{
- uint8_t error;
+ uint8_t error = 0;
i2cDisableInt();
i2cSendStart();
error |= i2cWaitForComplete();
@@ -118,7 +118,7 @@ uint8_t setTMP100config(uint8_t address, uint8_t data)
uint8_t setTMP101Thermo(uint8_t address, uint8_t data, uint8_t tHigh)
{
- uint8_t error;
+ uint8_t error = 0;
i2cDisableInt();
i2cSendStart();
error |= i2cWaitForComplete();
View
48 main.c
@@ -340,9 +340,9 @@ void receiveCommandHandler(uint8_t receiveDataLength, uint8_t* recieveData)
//if(receiveDataLength == 3)
{
int16_t holder = ((uint16_t)recieveData[1]<<8) + recieveData[2];
- eeprom_write_word(&EEballastTargetPositiveVSpeed, holder);
+ eeprom_write_word((uint16_t *)&EEballastTargetPositiveVSpeed, holder);
}
- break;
+ break;
case 0x03:
//set Over Ocean Flag
//if(receiveDataLength == 2)
@@ -362,7 +362,7 @@ void receiveCommandHandler(uint8_t receiveDataLength, uint8_t* recieveData)
//set Night Temperature Forecast
//if(receiveDataLength == 2)
{
- eeprom_write_byte(&EEnightTemperatureForecast, recieveData[1]);
+ eeprom_write_byte((uint8_t *)&EEnightTemperatureForecast, recieveData[1]);
}
break;
case 0x06:
@@ -417,9 +417,9 @@ void receiveCommandHandler(uint8_t receiveDataLength, uint8_t* recieveData)
//if(receiveDataLength == 2)
{
uint8_t error;
- eeprom_write_byte(&EEbatteryHeaterSetpoint, recieveData[1]);
- error |= setTMP101Thermo(TMP101BH, set12bit2scomp(eeprom_read_byte(&EEbatteryHeaterSetpoint))*16, 0);
- error |= setTMP101Thermo(TMP101BH, set12bit2scomp(eeprom_read_byte(&EEbatteryHeaterSetpoint))*16+32, 1);
+ eeprom_write_byte((uint8_t *)&EEbatteryHeaterSetpoint, recieveData[1]);
+ error |= setTMP101Thermo(TMP101BH, set12bit2scomp(eeprom_read_byte((uint8_t *)&EEbatteryHeaterSetpoint))*16, 0);
+ error |= setTMP101Thermo(TMP101BH, set12bit2scomp(eeprom_read_byte((uint8_t *)&EEbatteryHeaterSetpoint))*16+32, 1);
#ifdef GSPDEBUG
if(error != 0)
{
@@ -497,7 +497,7 @@ void receiveCommandHandler(uint8_t receiveDataLength, uint8_t* recieveData)
//if(receiveDataLength == 3)
{
uint16_t holder = ((uint16_t)recieveData[1] << 8) + recieveData[2];
- eeprom_write_word(&EEmaydayVSpeed, holder);
+ eeprom_write_word((uint16_t *)&EEmaydayVSpeed, holder);
}
break;
case 0x15:
@@ -519,7 +519,7 @@ void receiveCommandHandler(uint8_t receiveDataLength, uint8_t* recieveData)
//if(receiveDataLength == 3)
{
int16_t holder = ((uint16_t)recieveData[1]<<8) + recieveData[2];
- eeprom_write_word(&EEballastTargetNegativeVSpeed, holder);
+ eeprom_write_word((uint16_t *)&EEballastTargetNegativeVSpeed, holder);
}
break;
case 0x19:
@@ -708,15 +708,15 @@ void dumpVarsToGSP(void)
_delay_ms(500);
lprintf_P(PSTR("ballastTrgtAlt: %u"), eeprom_read_word(&EEballastTargetAltitude));
- lprintf_P(PSTR("ballastTrgt +Vspd: %d"), eeprom_read_word(&EEballastTargetPositiveVSpeed));
- lprintf_P(PSTR("ballastTrgt -Vspd: %d"), eeprom_read_word(&EEballastTargetNegativeVSpeed));
+ lprintf_P(PSTR("ballastTrgt +Vspd: %d"), eeprom_read_word((uint16_t *)&EEballastTargetPositiveVSpeed));
+ lprintf_P(PSTR("ballastTrgt -Vspd: %d"), eeprom_read_word((uint16_t *)&EEballastTargetNegativeVSpeed));
lprintf_P(PSTR("maydayAlt: %ud"), eeprom_read_word(&EEmaydayAltitude));
- lprintf_P(PSTR("maydayVSpd: %d"), eeprom_read_word(&EEmaydayVSpeed));
+ lprintf_P(PSTR("maydayVSpd: %d"), eeprom_read_word((uint16_t *)&EEmaydayVSpeed));
_delay_ms(500);
lprintf_P(PSTR("ballastSftyAlt: %u"), eeprom_read_word(&EEballastSafetyAltThresh));
- uint8_t variable = (volatile)eeprom_read_byte(&EEautoBallastDisable);
+ uint8_t variable = (volatile int)eeprom_read_byte(&EEautoBallastDisable);
lprintf_P(PSTR("autoBallast dsbled?: %d"), variable);
//lprintf_P(PSTR("overOcean? %d"), eeprom_read_byte(&EEoverOceanFlag));
@@ -727,7 +727,7 @@ void dumpVarsToGSP(void)
lprintf_P(PSTR("maxAllowedTXInterval: %u"), eeprom_read_word(&EEmaxAllowableTXInterval));
- lprintf_P(PSTR("batteryHeaterSet: %d"), eeprom_read_byte(&EEbatteryHeaterSetpoint));
+ lprintf_P(PSTR("batteryHeaterSet: %d"), eeprom_read_byte((uint8_t *)&EEbatteryHeaterSetpoint));
lprintf_P(PSTR("dataSampleInterval: %u"), eeprom_read_word(&EEdataCollectionInterval));
lprintf_P(PSTR("batchTXInterval: %u"), eeprom_read_word(&EEdataTransmitInterval));
@@ -785,7 +785,7 @@ void processMonitor(uint32_t time)
{
scheduleQueueAdd(&turnHfOn, time);
scheduleQueueAdd(&turnHfOff, time+hfLengthToTx);
- eeprom_write_word(&EEhfTimeToTx, time+eeprom_read_byte(&EEhfDataTransmitInterval));
+ eeprom_write_word(&EEhfTimeToTx, time+eeprom_read_byte((uint8_t *)&EEhfDataTransmitInterval));
}
getGPS(&currentPositionData);
@@ -826,10 +826,10 @@ void processMonitor(uint32_t time)
//conver to 8 bit
//If battery temp is below setpoint, turn on telemetry channel
- int8_t batterySetpoint = eeprom_read_byte(&EEbatteryHeaterSetpoint);;
+ int8_t batterySetpoint = eeprom_read_byte((uint8_t *)&EEbatteryHeaterSetpoint);;
if(batteryTemperature < batterySetpoint)
{
- currentBitmask[0] |= (uint32_t)(1<<24);
+ currentBitmask[0] |= ((uint32_t)(1UL<<24UL));
}
//GET RAW PACK VOLTAGE, If below Nominal, transmit
@@ -1021,13 +1021,13 @@ void autoBallast(uint32_t time)
#ifdef FCPUDEBUG
//lprintf_P(PSTR("Ballast: TVSpeed+"));
#endif
- currentTargetVspeed = eeprom_read_word(&EEballastTargetPositiveVSpeed);
+ currentTargetVspeed = eeprom_read_word((uint16_t *)&EEballastTargetPositiveVSpeed);
} else if(thisAltitude > targetAltitude)
{
#ifdef FCPUDEBUG
//lprintf_P(PSTR("Ballast: TVSpeed-"));
#endif
- currentTargetVspeed = eeprom_read_word(&EEballastTargetNegativeVSpeed);
+ currentTargetVspeed = eeprom_read_word((uint16_t *)&EEballastTargetNegativeVSpeed);
} /*else if(thisAltitude < targetAltitude && vSpeedAvg < currentTargetVspeed)
{
#ifdef FCPUDEBUG
@@ -1100,7 +1100,7 @@ void collectData(uint32_t time)
#ifdef FCPUDEBUG
lprintf_P(PSTR("In Data Collect"));
#endif
- char sampleString[SAMPLESTRINGSIZEINCHARS];
+ char sampleString[SAMPLESTRINGSIZEINCHARS+1];
memset(sampleString, 0x00, SAMPLESTRINGSIZEINCHARS);
//get time
uint32_t epochNow = now();
@@ -1602,14 +1602,14 @@ void flightPhaseLogic(uint32_t time)
uint16_t thisAltitude = myGPS.altitude;
uint16_t maydayAltitude = eeprom_read_word(&EEmaydayAltitude);
- int16_t maydayVSpeed = eeprom_read_word(&EEmaydayVSpeed);
+ int16_t maydayVSpeed = eeprom_read_word((uint16_t *)&EEmaydayVSpeed);
uint8_t myPhase = currentPhase & 0x0F;
uint8_t myFlags = currentPhase >> 4;
switch(myPhase)
{
case 0:
- if(((PIND & _BV(TAKEOFFPIN))>>TAKEOFFPIN == 1) && (myFlags & 1 == 1))
+ if(((PIND & _BV(TAKEOFFPIN))>>TAKEOFFPIN == 1) && ((myFlags & 1) == 1))
{
#ifdef FCPUDEBUG
_delay_ms(500);
@@ -1640,7 +1640,7 @@ void flightPhaseLogic(uint32_t time)
//reschedule 1 minute from now
- if((myGPS.altitude > 8500) && (vSpeedAvg < 0) && (myFlags & 1 == 1) || (cutdownStatus == 1))
+ if(((myGPS.altitude > 8500) && (vSpeedAvg < 0) && ((myFlags & 1) == 1)) || (cutdownStatus == 1))
{
myPhase = 2;
}
@@ -1653,7 +1653,7 @@ void flightPhaseLogic(uint32_t time)
//disable rapid hf xmit
rapidHFEnable = 0;
//make sure sat is enabled in here! BEFORE FLIGHT
- if((vSpeedAvg < maydayVSpeed) || (thisAltitude < maydayAltitude) || (cutdownStatus == 1) && (myFlags & 1 == 1))
+ if(((vSpeedAvg < maydayVSpeed) || (thisAltitude < maydayAltitude) || (cutdownStatus == 1)) && ((myFlags & 1) == 1))
{
#ifdef FCPUDEBUG
lprintf_P(PSTR("Phase 3 Criteria"));
@@ -1674,7 +1674,7 @@ void flightPhaseLogic(uint32_t time)
scheduleQueueAdd(&rapidHFXmit, time);
}
rapidHFEnable = 1;
- if((vSpeedAvg > maydayVSpeed) && (thisAltitude > maydayAltitude) && (cutdownStatus == 0) && (myFlags & 1 == 1))
+ if((vSpeedAvg > maydayVSpeed) && (thisAltitude > maydayAltitude) && (cutdownStatus == 0) && ((myFlags & 1) == 1))
{
myPhase = 2;
}
View
@@ -39,7 +39,7 @@ eeprom_write_byte(&EEoverOceanFlag, 0);
eeprom_write_word(&EEmaxAllowableTXInterval, 3600);
-eeprom_write_byte(&EEbatteryHeaterSetpoint, -20);
+eeprom_write_byte((uint8_t *)&EEbatteryHeaterSetpoint, -20);
eeprom_write_word(&EEdataCollectionInterval, 60);
eeprom_write_word(&EEdataTransmitInterval, 900);
@@ -66,11 +66,11 @@ eeprom_write_dword(&EEcurrentTelemetryBitmap[2], 0);
eeprom_write_word(&EEcurrentTelemetryVersion, 0);
eeprom_write_word(&EEballastTargetAltitude, 10000);
-eeprom_write_word(&EEballastTargetPositiveVSpeed, 5);
-eeprom_write_word(&EEballastTargetNegativeVSpeed, -5);
+eeprom_write_word((uint16_t *)&EEballastTargetPositiveVSpeed, 5);
+eeprom_write_word((uint16_t *)&EEballastTargetNegativeVSpeed, -5);
eeprom_write_word(&EEmaydayAltitude, 1000);
-eeprom_write_word(&EEmaydayVSpeed, -100);
+eeprom_write_word((uint16_t *)&EEmaydayVSpeed, -100);
eeprom_write_byte(&EEautoBallastDisable, 1);
Oops, something went wrong.

0 comments on commit 9784823

Please sign in to comment.