This commit is contained in:
kraus 2019-01-20 07:35:02 +01:00
parent 2ecd403c2d
commit 75a51dfb25
4 changed files with 137 additions and 59 deletions

View File

@ -108,7 +108,7 @@ https://github.com/olikraus/u8g2 ChangeLog
* Support for SSD1329 128x96 OLED (issue 208)
* Support for LC7981 240x128 (issue 193)
* Performance improvement for the ST7920 (issue 200)
2017-05-22 v2.15.2 olikraus@gmail.com
2017-05-22 v2.15.2 olikraus@gmail.com
* Added setBitmapMode (pull request 220)
Warning: Default behavior of drawXBM has changed in this release.
* Increased SPI speed to 8MHz for SSD1306, SH1106 and SSD1322 (issue 215)
@ -127,22 +127,22 @@ https://github.com/olikraus/u8g2 ChangeLog
* Support for 96x16 SSD1306 OLED (issue 295)
* Fixed OldStandard-Bold fonts (osb, issue 306)
* Support for SED1520/SBN1661 (issue 324)
2017-09-10 v2.17.11 olikraus@gmail.com
2017-09-10 v2.17.11 olikraus@gmail.com
* Additional _m_ and _h_ symbol fonts (issue 335)
* Added parallel interfaces for several UC16xx devices (issue 339)
* Support for IL3820, WaveShare 2.9" e-paper (issues 318 & 347)
* Improved debounce algorithm (issue 338)
* Power save mode for SSD1607 device (issue 352)
2017-09-30 v2.18.13 olikraus@gmail.com
2017-09-30 v2.18.13 olikraus@gmail.com
* Support for ST7567_JLX12864 (issue 365)
* Support for UC1611 (no "s") (issue 339)
* Fixed several issues related to the _F_ (full buffer) mode (issue 370)
2017-10-13 v2.19.8 olikraus@gmail.com
2017-10-13 v2.19.8 olikraus@gmail.com
* Support for UC1601 (issue 378)
* Support for ESP32 I2C pin remapping (issue 377)
* Support for ST75256 (SPI), JLX256128, JLX172104 (issue 163)
* Added uw-ttyp0 fonts (issue 349)
2017-12-09 v2.20.13 olikraus@gmail.com
2017-12-09 v2.20.13 olikraus@gmail.com
* Bugfix for drawBitmap (issue 391)
* I2C support for ST75256 (issue 384)
* Support for SSD1327 128x128 display (issue 397)
@ -153,7 +153,7 @@ https://github.com/olikraus/u8g2 ChangeLog
* New SH1106 init sequence (SH1106_WINSTAR, issue 316)
* Support for SSD1322 NHD 128x64 (issue 412)
* Fixed profont17 (issue 438)
2018-02-18 v2.21.8 olikraus@gmail.com
2018-02-18 v2.21.8 olikraus@gmail.com
* Support for SH1107 (issue 501)
* Support for HX1230 (issue 469)
* Bugfix for displays with display height not a multiple of 8 (issue 469)
@ -169,7 +169,7 @@ https://github.com/olikraus/u8g2 ChangeLog
including gb2312 support (issue 455)
* Added new full buffer demo for the Chinese fonts (Shennong.ino, issue #455)
* Added siji icon font u8g2_font_siji_t_6x10 (issue 451)
2018-04-30 v2.22.18 olikraus@gmail.com
2018-04-30 v2.22.18 olikraus@gmail.com
* Bugfix for draw1x2string (u8x8 API)
* Changed return value for "begin()" (issue 518)
* New feature: U8log, https://github.com/olikraus/u8g2/wiki/u8logreference
@ -185,7 +185,7 @@ https://github.com/olikraus/u8g2 ChangeLog
* Added Devanagari/Hindi font variant (issue 584)
* Added tom-thumb font (issue 563)
* Added AVR specific optimization for 3-wire Software SPI (issue 586)
2018-08-24 v2.23.18 olikraus@gmail.com
2018-08-24 v2.23.18 olikraus@gmail.com
* NEW FONT FORMAT for speedup of the unicode font section (issue 596)
* Fixed a bug in the font construction for monospaced fonts (issue 669)
* Fixed a bug with the CS line for huge KS0108 displays (issue 631)
@ -200,14 +200,14 @@ https://github.com/olikraus/u8g2 ChangeLog
* Added contributed 7-segment font, https://github.com/olikraus/u8g2/wiki/fntgrpu8g#7segments_26x42 (issue 634)
* Added several fonts from fontstruct.com, https://github.com/olikraus/u8g2/wiki/fntgrpfontstruct (issue 687)#
This also includes several outline fonts.
2018-10-28 v2.24.3 olikraus@gmail.com
2018-10-28 v2.24.3 olikraus@gmail.com
* Added clip window support (issue 364)
* Added setBusClock() proc to change the I2C/SPI bus clock speed (Arduino only, issue 705)
* Added sleep mode for ST7920 (issue 245)
* Added support for SSD0323 (issue 720)
2018-xx-xx v2.25.x olikraus@gmail.com
2019-xx-xx v2.25.x olikraus@gmail.com
* Improved speed for I2C with SSD1306 controller: 4% faster now (issue 735)
* Fixed code problems (issues 766 and 754)
* Added battery and emoticons (issue 747)
* Added battery symbols and emoticons (issue 747)
* New U8x8 font format, added large U8x8 fonts (issue 771)

View File

@ -478,7 +478,7 @@ uint8_t u8x8_cad_ssd13xx_fast_i2c(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, vo
in_transfer = 1;
/* lightning version: can replace the improved version from above */
/* the drawback of the lightning version is this: The complete init sequence */
/* must fit into the 32 byte Arduino Wire buffer, wbich might not always be the case */
/* must fit into the 32 byte Arduino Wire buffer, which might not always be the case */
/* speed improvement is about 6% compared to the classic version */
// if ( in_transfer == 0 )
// {

View File

@ -2,7 +2,7 @@
AirQuality.ino
ATMEGA328 (Arduino UNO) only
ATMEGA328P (Arduino UNO/Pro Trinket) only
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
@ -195,6 +195,8 @@ uint8_t is_display_enabled = 0; // modified by enable_display() and disable_dis
//===================================================
// Variables: Air quality sensor related varables
uint8_t is_ethanol_read = 0;
float temperature_raw;
float humidity_raw;
uint8_t temperature; /* with offset and multiplied by 2 */
@ -203,8 +205,10 @@ uint16_t tvoc_raw;
uint16_t tvoc_lp;
uint16_t eco2_raw;
uint16_t eco2_lp;
uint16_t ethanol_raw = 0;
int is_air_quality_available = 0;
// Calibration values, values seem to be 0x8a27 and 0x08a98 for my sensor, so 0 will be used as not set
uint16_t eco2_base = 0; // calibration value eCO2
uint16_t tvoc_base = 0; // calibration value TVOC
@ -496,6 +500,37 @@ void setup(void) {
//===================================================
// read ethanol value from SGP30
// bypass Adafruit lib, because this command is not included
// not used at the moment
uint16_t readEthanol(void)
{
uint8_t buf[6];
uint8_t i;
Wire.beginTransmission(0x58);
Wire.write(0x20); // 0x2050: measure signals command
Wire.write(0x50);
Wire.endTransmission();
delay(200); // max 200ms according to the datasheet
if (Wire.requestFrom(0x58, 6) != 6)
return 0;
for (i=0; i<6; i++)
buf[i] = Wire.read();
// each data value has: msb, lsb and crc
// ethanol value is the second data returned
// crc is ignored
return (((uint16_t)buf[3])<<8) + (uint16_t)buf[4];
}
//===================================================
void readBatteryVoltageLevel(void)
{
battery_raw = analogRead(0);
@ -533,56 +568,77 @@ void startAirQuality(void)
void readAirQuality(void)
{
uint8_t i;
int32_t tvoc_coeff = 7; // 1..32
int32_t eco2_coeff = 7; // 1..32
sht.readSample();
temperature_raw = sht.getTemperature();
humidity_raw = sht.getHumidity();
if ( temperature_raw <= (float)TEMP_LOW )
if ( is_ethanol_read == 0 )
{
temperature = 0;
}
else if ( temperature_raw >= (float)TEMP_HIGH )
{
temperature = TEMP_HIGH - TEMP_LOW;
temperature *= 2;
// normal air quality read
sht.readSample();
temperature_raw = sht.getTemperature();
humidity_raw = sht.getHumidity();
if ( temperature_raw <= (float)TEMP_LOW )
{
temperature = 0;
}
else if ( temperature_raw >= (float)TEMP_HIGH )
{
temperature = TEMP_HIGH - TEMP_LOW;
temperature *= 2;
}
else
{
temperature = (uint8_t)((temperature_raw-(float)TEMP_LOW)*2.0);
}
humidity = (uint8_t)((humidity_raw)*2.0);
sgp.setHumidity(getAbsoluteHumidity(temperature_raw, humidity_raw));
is_air_quality_available = sgp.IAQmeasure();
if ( is_air_quality_available )
{
tvoc_raw = sgp.TVOC;
eco2_raw = sgp.eCO2;
}
else
{
tvoc_raw = 0;
eco2_raw = 400;
}
if ( is_new_history_entry != 0 )
{
add_hist_new();
is_new_history_entry = 0;
}
else
{
add_hist_minmax();
}
// ethanol should be read only, if the display is active:
/* not used
if ( is_display_enabled )
{
is_ethanol_read = 1;
}
*/
}
else
{
temperature = (uint8_t)((temperature_raw-(float)TEMP_LOW)*2.0);
}
humidity = (uint8_t)((humidity_raw)*2.0);
// special ethanol read
//ethanol_raw = readEthanol();
sgp.setHumidity(getAbsoluteHumidity(temperature_raw, humidity_raw));
is_air_quality_available = sgp.IAQmeasure();
if ( is_air_quality_available )
{
tvoc_raw = sgp.TVOC;
eco2_raw = sgp.eCO2;
// according to the datasheet, the baseline values are corrupted... so restore them if available
//if ( eco2_base != 0 )
// sgp.setIAQBaseline(eco2_base, tvoc_base); // Restore the baseline values
is_ethanol_read = 0; // next: read normal air quality values
}
else
{
tvoc_raw = 0;
eco2_raw = 400;
}
if ( is_new_history_entry != 0 )
{
add_hist_new();
is_new_history_entry = 0;
}
else
{
add_hist_minmax();
}
}
@ -840,12 +896,14 @@ void draw_1_4_system(u8g2_uint_t x, u8g2_uint_t y)
{
u8g2.setFont(FONT_SMALL);
u8g2.setCursor(x, y+11);
u8g2.print(F("Shake "));
u8g2.print(shake_last_cnt);
u8g2.print(F("ETH "));
u8g2.print(ethanol_raw, HEX);
u8g2.setCursor(x, y+21);
u8g2.print(F("State "));
u8g2.print(F("St "));
u8g2.print(state);
u8g2.print(F(" Sh "));
u8g2.print(shake_last_cnt);
u8g2.setCursor(x, y+31);
u8g2.print(F("Bat "));

View File

@ -418,6 +418,25 @@ struct controller controller_list[] =
}
},
/* issue 784 */
{
"ssd1318", 16, 12, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_4WSPI|COM_3WSPI|COM_6800|COM_8080|COM_8080,
"", /* is_generate_u8g2_class= */ 1,
{
{ "128x96" },
{ NULL }
}
},
{
"ssd1318", 16, 12, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_ssd13xx_fast_i2c", "i2c", COM_I2C,
"", /* is_generate_u8g2_class= */ 1,
{
{ "128x96" },
{ NULL }
}
},
{
"ssd1325", 16, 8, "u8g2_ll_hvline_vertical_top_lsb", "u8x8_cad_001", "", COM_4WSPI|COM_3WSPI|COM_6800|COM_8080,
"", /* is_generate_u8g2_class= */ 1,
@ -822,6 +841,7 @@ struct controller controller_list[] =
{ "lm6059" },
{ "lx12864" },
{ "erc12864" },
{ "erc12864_alt" }, /* issue 790 */
{ "nhd_c12864" },
{ "jlx12864" },
{ NULL }
@ -1183,7 +1203,7 @@ struct controller controller_list[] =
{
{ "200x200" },
{ "gd_200x200" }, // GDEP015OC1
//{ "v2_200x200" },
{ "ws_200x200" }, // Waveshare issue #637
{ NULL }
}
},