# HG changeset patch # User kripperger@CL-SEC241-09.cedarville.edu # Date 2013-01-10 14:45:18 # Node ID 1614c3d5e9cd1ed1415177d2b71397fb3de20b87 # Parent b23f284b2449ae20d1c01d0dbcb0d4bffc5b37b5 Optimizations and setting up loop timer diff --git a/slave/slave/lib/geiger.c b/slave/slave/lib/geiger.c --- a/slave/slave/lib/geiger.c +++ b/slave/slave/lib/geiger.c @@ -44,6 +44,6 @@ uint16_t geiger_getCpm() uint8_t geiger_getCount() //DEBUG { - return seconds; + return counts; } diff --git a/slave/slave/lib/loopTimer.c b/slave/slave/lib/loopTimer.c --- a/slave/slave/lib/loopTimer.c +++ b/slave/slave/lib/loopTimer.c @@ -15,10 +15,9 @@ volatile uint32_t millis = 0; // Milliseconds since initialization - void time_setup() { - DDRA = 0xff; + DDRA = 0xFF; // Generic microcontroller config options OCR0A = 173; // Approx 172.7969 ticks per ms with 64 prescaler @@ -32,7 +31,7 @@ void time_setup() ISR(TIMER0_OVF_vect) { - millis = millis + 1; + millis = millis + 1; } uint32_t time_millis() diff --git a/slave/slave/lib/loopTimer.h b/slave/slave/lib/loopTimer.h --- a/slave/slave/lib/loopTimer.h +++ b/slave/slave/lib/loopTimer.h @@ -10,10 +10,8 @@ #define LOOPTIMER_H_ -void time_setup(); - +void time_setup(); uint32_t time_millis(); - #endif /* LOOPTIMER_H_ */ \ No newline at end of file diff --git a/slave/slave/lib/sensors.c b/slave/slave/lib/sensors.c --- a/slave/slave/lib/sensors.c +++ b/slave/slave/lib/sensors.c @@ -48,7 +48,7 @@ void sensors_readBoardTemp() { boardTemp = i2c_read(BOARDTEMP_ADDR, 0x00); // Read only the first byte of data (we don't need the resolution here) boardTemp = ((boardTemp*18)/10) + (32); // Converting Celsius to Fahrenheit - boardTemp = boardTemp - 1; // Linear offset + boardTemp = boardTemp - 3; // Linear offset } int16_t sensors_getSpiTemp(void) // Gets spi temperature from variable diff --git a/slave/slave/slave.c b/slave/slave/slave.c --- a/slave/slave/slave.c +++ b/slave/slave/slave.c @@ -42,6 +42,7 @@ int main(void) { // Initialize micro_setup(); // Generic microcontroller config options + time_setup(); led_configure(); // Configure ports and registers for LED operation io_configure(); // Configure IO ports and registers @@ -51,6 +52,7 @@ int main(void) uint8_t moduleID = io_getModuleId(); // Slave Module ID from rotary dip switch modules_setup(moduleID); // Run setup functions for specific module + uint32_t milliseconds; uint8_t test; //Debug uint8_t test2; //Debug @@ -99,7 +101,7 @@ int main(void) test2 = sensors_getBoardTemp(); //DEBUG/////////////////////////////////////////////////////////////////////////// - + time_millis(); sprintf(buff, "|ModuleID: %u |BoardTemp: %u |Seconds: %u\r\n",moduleID,test2,test); //DEBUG serial0_sendString(buff); //DEBUG