Skip to content

Commit

Permalink
Version 1.8 - improved brightnes handling and added option to increase
Browse files Browse the repository at this point in the history
"brf xx" command introduced, where xx, is the factor*10
  • Loading branch information
vlast3k committed Jan 10, 2016
1 parent d4541dc commit 119c929
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 1,877 deletions.
1 change: 1 addition & 0 deletions Menu.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void handleCommand() {
else if (x.startsWith(F("ubiv"))) saveLineToEE(trim(&line[4]), EE_40B_UBIVAR);
else if (x.startsWith(F("test"))) sendToThingSpeak(567);
else if (x.startsWith(F("brg" ))) menuEnterLedBrightness(trim(&line[3]));
else if (x.startsWith(F("brf" ))) EEPROM.put(EE_1B_BRG_FACTOR, (byte)(atoi(&line[4])));
else if (x.startsWith(F("gray" ))) switchGrayBox();
//else if (x.startsWith(F("sim" ))) simulateCO2();
//else if (x.startsWith(F("ota" ))) espOTA();
Expand Down
17 changes: 14 additions & 3 deletions Neopixel.ino
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,24 @@ void initNeopixels() {
void debugInfoNeopixel() {
Serial << F("Brightness :") << sBrightness<< endl;
}

float getBrgFactor() {
byte bb = EEPROM.read(EE_1B_BRG_FACTOR);
return (float)(bb==255?10:bb) / 10;

}
void processBrightness() {
if (overrideBrightness == 255) {
raLight.addValue(analogReadFine(LIGHT_PIN, 1));
int maxLightRead = EEPROM.read(EE_1B_ISGRAY) == 1 ? 400 : 1000;
int r = constrain((int)raLight.getAverage(), 0, maxLightRead);
sBrightness = map(r, 0, maxLightRead, 1, maxBrightness);
int light = (int)(raLight.getAverage() * getBrgFactor());
int r=0;
if (light <= 10) {
sBrightness = light;
} else {
r = constrain(light, 0, maxLightRead);
sBrightness = map(r, 11, maxLightRead, 11, maxBrightness);
}
//Serial << maxLightRead << "." << r << "." << sBrightness << "." << maxBrightness << endl;
} else {
sBrightness = overrideBrightness;
}
Expand Down
2 changes: 1 addition & 1 deletion OLED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ U8GLIB_SSD1306_128X64 u8g(6, 7, 8); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pi
byte contrast = 0;

void oledCO2Level() {
if (dumpDebuggingInfo) return;
//if (dumpDebuggingInfo) return;
u8g.setColorIndex(1);
u8g.setContrast(255);
u8g.firstPage();
Expand Down
66 changes: 66 additions & 0 deletions fw/ATMega328_ESP8266_OnlyESP.cpp.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
:100000000C945C000C946E000C946E000C946E00CA
:100010000C946E000C946E000C946E000C946E00A8
:100020000C946E000C946E000C946E000C946E0098
:100030000C946E000C946E000C946E000C946E0088
:100040000C948B000C946E000C946E000C946E005B
:100050000C946E000C946E000C946E000C946E0068
:100060000C946E000C946E00000000080002010069
:100070000003040700000000000000000102040863
:100080001020408001020408102001020408102002
:10009000040404040404040402020202020203032E
:1000A0000303030300000000250028002B000000CC
:1000B0000000240027002A0011241FBECFEFD8E043
:1000C000DEBFCDBF21E0A0E0B1E001C01D92A930AC
:1000D000B207E1F70E94F4010C9404020C940000B2
:1000E00061E082E00E94840160E089E00E94840176
:1000F00060E08AE00E94840160E082E00E94BD012D
:1001000060ED77E080E090E00E94F80061E082E03E
:100110000C94BD0108951F920F920FB60F921124F7
:100120002F933F938F939F93AF93BF938091010140
:1001300090910201A0910301B0910401309100015E
:1001400023E0230F2D3720F40196A11DB11D05C01A
:1001500026E8230F0296A11DB11D20930001809374
:10016000010190930201A0930301B09304018091D7
:10017000050190910601A0910701B0910801019637
:10018000A11DB11D8093050190930601A093070165
:10019000B0930801BF91AF919F918F913F912F91A3
:1001A0000F900FBE0F901F9018953FB7F894809155
:1001B000050190910601A0910701B091080126B5B3
:1001C000A89B05C02F3F19F00196A11DB11D3FBF8F
:1001D0006627782F892F9A2F620F711D811D911D1F
:1001E00042E0660F771F881F991F4A95D1F708953F
:1001F000CF92DF92EF92FF92CF93DF936B017C015E
:100200000E94D500EB01C114D104E104F10489F08E
:100210000E9403020E94D5006C1B7D0B683E734058
:1002200090F381E0C81AD108E108F108C851DC4F09
:10023000EACFDF91CF91FF90EF90DF90CF900895BC
:10024000789484B5826084BD84B5816084BD85B5B1
:10025000826085BD85B5816085BDEEE6F0E0808178
:1002600081608083E1E8F0E0108280818260808399
:10027000808181608083E0E8F0E08081816080831C
:10028000E1EBF0E0808184608083E0EBF0E080814E
:1002900081608083EAE7F0E08081846080838081F0
:1002A0008260808380818160808380818068808398
:1002B0001092C1000895833081F028F4813099F0C4
:1002C0008230A1F008958730A9F08830B9F08430E9
:1002D000D1F4809180008F7D03C0809180008F7762
:1002E00080938000089584B58F7702C084B58F7D98
:1002F00084BD08958091B0008F7703C08091B000D5
:100300008F7D8093B0000895CF93DF9390E0FC0140
:10031000E458FF4F2491FC01E057FF4F849188235C
:1003200049F190E0880F991FFC01E255FF4FA5911C
:10033000B4918C559F4FFC01C591D4919FB7611129
:1003400008C0F8948C91209582238C938881822315
:100350000AC0623051F4F8948C91322F3095832387
:100360008C938881822B888304C0F8948C91822B93
:100370008C939FBFDF91CF9108950F931F93CF93DD
:10038000DF931F92CDB7DEB7282F30E0F901E8598F
:10039000FF4F8491F901E458FF4F1491F901E057A0
:1003A000FF4F04910023C9F0882321F069830E9444
:1003B0005B016981E02FF0E0EE0FFF1FEC55FF4F6E
:1003C000A591B4919FB7F8948C91611103C01095D9
:1003D000812301C0812B8C939FBF0F90DF91CF9120
:1003E0001F910F91089508950E9420010E94F3012A
:1003F0000E947000C0E0D0E00E948A002097E1F3E4
:0C0400000E940000F9CF0895F894FFCF8F
:00000001FF
Binary file added fw/simple-co2-monitor-fw.1.8.zip
Binary file not shown.
Loading

0 comments on commit 119c929

Please sign in to comment.