Skip to content

Commit

Permalink
Added fixes for Cutdown at X time and Bitmask Uplink
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuph committed Mar 21, 2011
1 parent 3b79874 commit 1e65c2b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 48 deletions.
6 changes: 3 additions & 3 deletions WSB Flight Computer.depend
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@
"../dataStructures.h" "../dataStructures.h"
"openlog.h" "openlog.h"


1300128097 source:/home/bradluyster/Dev/git/LVL1-Transatlantic-Balloon/Software/fcpu/WSB Flight Computer/main.c 1300652007 source:/home/bradluyster/Dev/git/LVL1-Transatlantic-Balloon/Software/fcpu/WSB Flight Computer/main.c
<stdio.h> <stdio.h>
<stdint.h> <stdint.h>
<avr/io.h> <avr/io.h>
Expand Down Expand Up @@ -690,15 +690,15 @@
1298253528 /home/bradluyster/Dev/git/LVL1-Transatlantic-Balloon/Software/fcpu/WSB Flight Computer/eepromVars.h 1298253528 /home/bradluyster/Dev/git/LVL1-Transatlantic-Balloon/Software/fcpu/WSB Flight Computer/eepromVars.h
<avr/eeprom.h> <avr/eeprom.h>


1298507494 source:/home/bradluyster/Dev/git/LVL1-Transatlantic-Balloon/Software/fcpu/WSB Flight Computer/parsing/gps.c 1300655668 source:/home/bradluyster/Dev/git/LVL1-Transatlantic-Balloon/Software/fcpu/WSB Flight Computer/parsing/gps.c
<stdio.h> <stdio.h>
<stdint.h> <stdint.h>
<string.h> <string.h>
<avr/pgmspace.h> <avr/pgmspace.h>
<avr/wdt.h> <avr/wdt.h>
"gps.h" "gps.h"


1292126383 source:/home/bradluyster/Dev/git/LVL1-Transatlantic-Balloon/Software/fcpu/WSB Flight Computer/queue.c 1300655711 source:/home/bradluyster/Dev/git/LVL1-Transatlantic-Balloon/Software/fcpu/WSB Flight Computer/queue.c
<stdio.h> <stdio.h>
<stdint.h> <stdint.h>
<string.h> <string.h>
Expand Down
45 changes: 3 additions & 42 deletions main.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -242,52 +242,13 @@ int main (void)
} }




lprintf("SSAlive\n"); lprintf("SSAlive\n");

//lprintf("psamp\n");
//Test Routine for data Storage and Retreival
/*char sample1[SAMPLESTRINGSIZEINCHARS]= "0,583,0,72,0,+18.24";
char sample2[SAMPLESTRINGSIZEINCHARS]= "0,282,0,80,0,+18.90";
char sample3[SAMPLESTRINGSIZEINCHARS]= "0,163,0,04,0,-24.20";
putDataSample(sample1);
eeprom_write_word(&EEbatchSampleEnd, eeprom_read_word(&EEbatchSampleEnd)+1);
putDataSample(sample2);
eeprom_write_word(&EEbatchSampleEnd, eeprom_read_word(&EEbatchSampleEnd)+1);
putDataSample(sample3);
eeprom_write_word(&EEbatchSampleEnd, eeprom_read_word(&EEbatchSampleEnd)+1);
lprintf("SampleStart: %d\n", eeprom_read_word(&EEbatchSampleStart));
lprintf("SampleEnd: %d\n", eeprom_read_word(&EEbatchSampleEnd));
loadBatch();
*/

/*while(1)
{
struct gpsData testStruct;
getGPS(&testStruct);
_delay_ms(500);
lprintf("stat: %c sats: %d\n", testStruct.status, testStruct.numberOfSats);
lprintf("lat: %f lon: %f\n", testStruct.latitude, testStruct.longitude);
lprintf("now: %ld\n", now());
}*/


if((mcusr_mirror & 0x08) == 0x08) if((mcusr_mirror & 0x08) == 0x08)
{ {
//lprintf("WDTReset\n"); //lprintf("WDTReset\n");
} }




//lprintf("WDTCR: %x\n", WDTCSR);

//REMOVE BEFORE FLIGHT:
//eeprom_write_byte(&EEflightPhase, 16);


uint32_t rnow = now(); uint32_t rnow = now();
scheduleQueueAdd(&resetWatchdog, rnow); scheduleQueueAdd(&resetWatchdog, rnow);
Expand Down Expand Up @@ -430,7 +391,7 @@ void receiveCommandHandler(uint8_t receiveDataLength, uint8_t* recieveData)
//set Custom Bitmask Select //set Custom Bitmask Select
//if(receiveDataLength == 13) //if(receiveDataLength == 13)
{ {
eeprom_write_block((uint16_t*)recieveData[1], &EEcurrentTelemetryBitmap, sizeof(uint32_t)*3); eeprom_write_block((uint8_t*)recieveData[1], &EEcurrentTelemetryBitmap, sizeof(uint32_t)*3);
} }
break; break;
case 0x0A: case 0x0A:
Expand Down Expand Up @@ -491,7 +452,7 @@ void receiveCommandHandler(uint8_t receiveDataLength, uint8_t* recieveData)
{ {
//It Looks Like You're trying to Schedule a cutdown! //It Looks Like You're trying to Schedule a cutdown!
//uint32_t time = ((uint32_t)recieveData[0] << 24) + ((uint32_t)recieveData[1] << 16) + ((uint32_t)recieveData[2] << 8) + recieveData[3]; //uint32_t time = ((uint32_t)recieveData[0] << 24) + ((uint32_t)recieveData[1] << 16) + ((uint32_t)recieveData[2] << 8) + recieveData[3];
uint32_t time = ((uint32_t)recieveData[0]<<16) + ((uint32_t)recieveData[1] << 8); uint32_t time = (((uint32_t)recieveData[0]<<8) + ((uint32_t)recieveData[1]))*60;
scheduleQueueAdd(&timedCutdown, time); scheduleQueueAdd(&timedCutdown, time);
} }
break; break;
Expand Down
3 changes: 3 additions & 0 deletions parsing/gps.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void getGPS(struct gpsData *outputData)
} }
lineBuff[i] = '\0'; lineBuff[i] = '\0';
errorTracker++; errorTracker++;
wdt_reset();
} while((strncmp("$GPRMC", lineBuff, 6) != 0) && errorTracker < 100); } while((strncmp("$GPRMC", lineBuff, 6) != 0) && errorTracker < 100);
// End GPRMC Acquisition Section // End GPRMC Acquisition Section


Expand Down Expand Up @@ -148,6 +149,7 @@ void getGPS(struct gpsData *outputData)
i++; i++;
} }
errorTracker++; errorTracker++;
wdt_reset();
lineBuff[i] = '\0'; lineBuff[i] = '\0';
} while((strncmp("$GPGSA", lineBuff, 6) != 0) && errorTracker < 100); } while((strncmp("$GPGSA", lineBuff, 6) != 0) && errorTracker < 100);
// End GPGSA Acquisition Section // End GPGSA Acquisition Section
Expand Down Expand Up @@ -210,6 +212,7 @@ void getGPS(struct gpsData *outputData)
} }
lineBuff[i] = '\0'; lineBuff[i] = '\0';
errorTracker++; errorTracker++;
wdt_reset();
} while((strncmp("$GPGGA", lineBuff, 6) != 0) && errorTracker < 100); } while((strncmp("$GPGGA", lineBuff, 6) != 0) && errorTracker < 100);
// End GPGGA Acquisition Section // End GPGGA Acquisition Section
wdt_reset(); wdt_reset();
Expand Down
8 changes: 5 additions & 3 deletions queue.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ int8_t scheduleQueueAlterTime(scheduledFunction thisFunction, uint32_t newTime)
/*#ifdef FCPUDEBUG /*#ifdef FCPUDEBUG
lprintf_P(PSTR("Running some function\n")); lprintf_P(PSTR("Running some function\n"));
#endif*/ #endif*/
scheduleQueueAdd(storageFunction, newTime); scheduleQueueAdd(storageFunction, newTime);
} return 0;
} else { } else {
scheduleQueueAdd(storageFunction, scheduleTime); scheduleQueueAdd(storageFunction, scheduleTime);

} }


} }
return 1;
} }

0 comments on commit 1e65c2b

Please sign in to comment.