# HG changeset patch # User kripperger@CL-SEC241-09.cedarville.edu # Date 2013-01-21 19:39:31 # Node ID 6b25c240180b11220f550442437f8c4aa867dd1e # Parent 9e3e1986377f49bc44c0a6b343327115ccdcb056 Heater configurations diff --git a/slave/slave/config.h b/slave/slave/config.h --- a/slave/slave/config.h +++ b/slave/slave/config.h @@ -16,13 +16,14 @@ #define SENSOR_LOOP 100 // Frequency of sensor reads (in ms) -#define HEATER_THRESHOLD 70 // Temperature threshold in Fahrenheit where heater is activated +#define HEATER_THRESHOLD 40 // Temperature threshold in Fahrenheit where heater is activated //I2C Addresses - #define BOARDTEMP_ADDR 0x90 // Read 0x91 - Write 0x90 - #define PRESSURE_ADDR 0xA1 //THIS VALUE IS WRONG - #define HUMID_ADDR 0xA4 //THIS VALUE IS WRONG - #define RTC_ADDR 0xA2 //DEBUG [Used for testing] // Read 0xA3 - Write 0xA2 + #define EEPROM_ADDR 0xA0 // Read 0xA1 - Write 0xA0 + #define BOARDTEMP_ADDR 0x90 // Read 0x91 - Write 0x90 + #define PRESSURE_ADDR 0xB1 //THIS VALUE IS WRONG + #define HUMID_ADDR 0xB4 //THIS VALUE IS WRONG + #define RTC_ADDR 0xB2 //DEBUG [Used for testing] // Read 0xA3 - Write 0xA2 diff --git a/slave/slave/lib/inputOutput.c b/slave/slave/lib/inputOutput.c --- a/slave/slave/lib/inputOutput.c +++ b/slave/slave/lib/inputOutput.c @@ -27,6 +27,9 @@ uint8_t id; id = 0; + + + // This method is temporary as the next release will read the module ID from EEPROM PORTC |= (1 << PC2); // Pull pins on rotary dip high PORTC |= (1 << PC3); // Pull pins on rotary dip high @@ -37,6 +40,10 @@ id = ~id; //Invert Dip reading id = (id & 0b0111); //Mask bits + + //id = i2c_read(EEPROM_ADDR, 0x04); + + return id; } @@ -50,6 +57,15 @@ PORTB &= ~(1 << PB4); //OFF } + uint8_t io_heaterStatus() + { + uint8_t state; + state = 0; + + state = ((PORTB & 0b00010000) >> 4); + + return state; + } void io_regulateTemp() { diff --git a/slave/slave/lib/inputOutput.h b/slave/slave/lib/inputOutput.h --- a/slave/slave/lib/inputOutput.h +++ b/slave/slave/lib/inputOutput.h @@ -14,6 +14,7 @@ uint8_t io_getModuleId(); // Get ID from void io_heaterOn(); void io_heaterOff(); +uint8_t io_heaterStatus(); void io_regulateTemp(); // Gets board temperature and enables heater if below threshold diff --git a/slave/slave/slave.c b/slave/slave/slave.c --- a/slave/slave/slave.c +++ b/slave/slave/slave.c @@ -71,7 +71,7 @@ int main(void) io_regulateTemp(); // Gets board temperature and enables heater if below threshold - snprintf(buff,64,"|ModuleID: %u |BoardTemp: %i |Millis: %lu\r\n",moduleID,sensors_getBoardTemp(),time_millis()); //DEBUG + snprintf(buff,64,"|ModuleID: %u |BoardTemp: %i |Millis: %lu |Heater: %u\r\n",moduleID,sensors_getBoardTemp(),time_millis(),io_heaterStatus()); //DEBUG serial0_sendString(buff); //DEBUG led_toggle(0); // Toggle LED0(Blue) to show loop running