Skip to content

Commit

Permalink
SGP wrong temp workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrazio committed May 17, 2018
1 parent 54acd03 commit 4a5be0a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions ardufocus/ardufocus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ int main(void)
// ADC init routine ---------------------------------------------------------
// --------------------------------------------------------------------------
Analog::setup();
Analog::read(THERMISTOR_ADC_CHANNEL);


// --------------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions ardufocus/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@
// verify if the overall system accuracy increases.
//#define COMPRESS_HALF_STEPS


// According to the Moonlite protocol the temperature probe should only be read
// when the command ":C#" is received but some applications, such as SGP, seems
// not to respect this and only call the get temperature command ":GT#" which
// means the temperature will never get updated and the last value is always
// returned, either it is valid or not. Enabling the following option will force
// the temperature gathering process on every temperature read command.
// #define START_TEMP_CONVERSION_ON_EVERY_GET

// ----------------------------------------------------------------------------
// Temperature sensor configuration -------------------------------------------
// ----------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions ardufocus/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ void protocol::process(const char *cmd)
break;

case 'T': // Get the current temperature
#ifdef START_TEMP_CONVERSION_ON_EVERY_GET
Analog::read(THERMISTOR_ADC_CHANNEL);
#endif

sprintf(str, "%04X#", static_cast<int16_t>(util::steinhart(g_ambient)) << 1);
Log::string(str);
break;
Expand Down
4 changes: 2 additions & 2 deletions ardufocus/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#define __VERSION_H__

// Program version and release
#define ARDUFOCUS_VERSION "0.1c"
#define ARDUFOCUS_VERSION_BUILD "20180315"
#define ARDUFOCUS_VERSION "0.1d"
#define ARDUFOCUS_VERSION_BUILD "20180517"
#define ARDUFOCUS_URL "https://github.com/jbrazio/ardufocus"

#endif

0 comments on commit 4a5be0a

Please sign in to comment.