Skip to content

Commit

Permalink
Sensor Rotation Fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Vazquez committed Jul 8, 2017
1 parent ea59802 commit f2d7ecf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
16 changes: 11 additions & 5 deletions TempXD/configuration.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
// WIFI
#define WIFI_MODE "MANAGER" // JOIN (configure in code) // MANAGER
#define WIFI_MODE "JOIN" // JOIN (configure in code) // MANAGER
#define WIFI_AP_MANAGER "MashLoggerConfig" // AP Name For mode MANAGER
#define WIFI_NAME "myhomewifi" // AP Name For mode JOIN
#define WIFI_PASS "myappass" // AP Password For mode JOIN
#define WIFI_NAME "WifiName" // AP Name For mode JOIN
#define WIFI_PASS "WifiPass" // AP Password For mode JOIN


// Sensor ID
#define SENSOR_ID_LIQUOR "28FFF47BA815046C"
#define SENSOR_ID_MASH "28FF0268A81501D9"
#define SENSOR_ID_BOIL "28FF2DE143160468"


// Log to thingspeak
Expand All @@ -23,15 +29,15 @@
#define NTP_SYNC_INTERVAL 600 // Sync every N seconds

// Sensor Conf
#define GET_TEMP_EVERY_X_SECONDS 3 //
#define GET_TEMP_EVERY_X_SECONDS 5 //
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board of NodeMCU
#define TEMPERATURE_PRECISION 12 // DS18B20 Temperature presition set global resolution to 9, 10, 11, or 12 bits

// LOG TEMP TO SERIAL
#define SERIAL_TEMP_LOG_ENABLE true // Enable Show temperature in serial console

// Display Conf
#define DISPLAY_IC2_ENABLE false // Enable Display
#define DISPLAY_IC2_ENABLE true // Enable Display
#define DISPLAY_IC2_ADDRESS 0x3F // Display Address

// Webserver Conf
Expand Down
25 changes: 21 additions & 4 deletions TempXD/tempSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ void tempSensorPrintAddress(DeviceAddress deviceAddress)
}
}

String tempSensorGetAddress(DeviceAddress deviceAddress)
{
static char return_me[18];
static char *hex = "0123456789ABCDEF";
uint8_t i, j;

for (i=0, j=0; i<8; i++)
{
return_me[j++] = hex[deviceAddress[i] / 16];
return_me[j++] = hex[deviceAddress[i] & 15];
}
return_me[j] = '\0';

return String(return_me);
}


void tempSensorStart() {
// Start up the library
Expand Down Expand Up @@ -90,15 +106,16 @@ void getTempFromSensors() {
// Output the device ID
if (SERIAL_TEMP_LOG_ENABLE == true) {
Serial.print("Temperature for device ");
Serial.print(i,DEC);
Serial.print(tempSensorGetAddress(tempDeviceAddress));
Serial.print(": ");
Serial.println(temp);
}
if ( i == 0 ) { tempLiquor = temp ;}
if ( i == 1 ) { tempMash = temp ;}
if ( i == 2 ) { tempBoil = temp ;}
if ( tempSensorGetAddress(tempDeviceAddress) == SENSOR_ID_LIQUOR ) { tempLiquor = temp ;}
if ( tempSensorGetAddress(tempDeviceAddress) == SENSOR_ID_MASH ) { tempMash = temp ;}
if ( tempSensorGetAddress(tempDeviceAddress) == SENSOR_ID_BOIL ) { tempBoil = temp ;}
}
}

}


0 comments on commit f2d7ecf

Please sign in to comment.