summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/Narcoleptic/Narcoleptic.cpp57
-rw-r--r--libraries/Narcoleptic/Narcoleptic.h34
-rw-r--r--megalogger/megalogger.ino5
-rw-r--r--nanologger/MicroLCD.cpp49
-rw-r--r--nanologger/MicroLCD.h37
-rw-r--r--nanologger/nanologger.cbp241
-rw-r--r--nanologger/nanologger.depend71
-rw-r--r--nanologger/nanologger.ino24
8 files changed, 173 insertions, 345 deletions
diff --git a/libraries/Narcoleptic/Narcoleptic.cpp b/libraries/Narcoleptic/Narcoleptic.cpp
new file mode 100644
index 0000000..5da3924
--- /dev/null
+++ b/libraries/Narcoleptic/Narcoleptic.cpp
@@ -0,0 +1,57 @@
+/**
+ * Narcoleptic - A sleep library for Arduino
+ * Copyright (C) 2010 Peter Knight (Cathedrow)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <avr/common.h>
+//#include <util/delay.h>
+
+#include <avr/wdt.h>
+#include <avr/sleep.h>
+#include "Narcoleptic.h"
+
+SIGNAL(WDT_vect) {
+ wdt_disable();
+ wdt_reset();
+ WDTCSR &= ~_BV(WDIE);
+}
+
+void NarcolepticClass::sleep(uint8_t wdt_period) {
+ wdt_enable(wdt_period);
+ wdt_reset();
+ WDTCSR |= _BV(WDIE);
+ set_sleep_mode(SLEEP_MODE_PWR_DOWN);
+ sleep_mode();
+ wdt_disable();
+ WDTCSR &= ~_BV(WDIE);
+}
+
+void NarcolepticClass::delay(int milliseconds) {
+ while (milliseconds >= 8000) { sleep(WDTO_8S); milliseconds -= 8000; }
+ if (milliseconds >= 4000) { sleep(WDTO_4S); milliseconds -= 4000; }
+ if (milliseconds >= 2000) { sleep(WDTO_2S); milliseconds -= 2000; }
+ if (milliseconds >= 1000) { sleep(WDTO_1S); milliseconds -= 1000; }
+ if (milliseconds >= 500) { sleep(WDTO_500MS); milliseconds -= 500; }
+ if (milliseconds >= 250) { sleep(WDTO_250MS); milliseconds -= 250; }
+ if (milliseconds >= 125) { sleep(WDTO_120MS); milliseconds -= 120; }
+ if (milliseconds >= 64) { sleep(WDTO_60MS); milliseconds -= 60; }
+ if (milliseconds >= 32) { sleep(WDTO_30MS); milliseconds -= 30; }
+ if (milliseconds >= 16) { sleep(WDTO_15MS); milliseconds -= 15; }
+}
+
+NarcolepticClass Narcoleptic;
diff --git a/libraries/Narcoleptic/Narcoleptic.h b/libraries/Narcoleptic/Narcoleptic.h
new file mode 100644
index 0000000..9b1f255
--- /dev/null
+++ b/libraries/Narcoleptic/Narcoleptic.h
@@ -0,0 +1,34 @@
+/**
+ * Narcoleptic - A sleep library for Arduino
+ * Copyright (C) 2010 Peter Knight (Cathedrow)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef Narcoleptic_h
+#define Narcoleptic_h
+
+#include <inttypes.h>
+#include <stdbool.h>
+
+class NarcolepticClass
+{
+ public:
+ void delay(int milliseconds);
+ private:
+ void sleep(uint8_t);
+};
+extern NarcolepticClass Narcoleptic;
+
+#endif
diff --git a/megalogger/megalogger.ino b/megalogger/megalogger.ino
index 4a04cb9..b547efa 100644
--- a/megalogger/megalogger.ino
+++ b/megalogger/megalogger.ino
@@ -11,11 +11,12 @@
#include <Wire.h>
#endif
#include <OBD.h>
+#include <SPI.h>
#include <SD.h>
#include <MultiLCD.h>
#include <TinyGPS.h>
#include <MPU6050.h>
-#include <SPI.h>
+#include <Narcoleptic.h>
#include "config.h"
#include "images.h"
#if ENABLE_DATA_OUT && USE_SOFTSERIAL
@@ -445,6 +446,8 @@ private:
int value;
if (read(PID_RPM, value) && value > 0)
break;
+
+ Narcoleptic.delay(2000);
}
lcd.backlight(true);
state |= STATE_OBD_READY;
diff --git a/nanologger/MicroLCD.cpp b/nanologger/MicroLCD.cpp
index b4caf3c..a602b18 100644
--- a/nanologger/MicroLCD.cpp
+++ b/nanologger/MicroLCD.cpp
@@ -292,8 +292,6 @@ void LCD_SSD1306::setCursor(byte column, byte line)
size_t LCD_SSD1306::write(uint8_t c)
{
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
if (c == '\n') {
setCursor(0, m_row + ((m_font == FONT_SIZE_SMALL) ? 1 : 2));
return 1;
@@ -301,6 +299,10 @@ size_t LCD_SSD1306::write(uint8_t c)
m_col = 0;
return 1;
}
+#ifdef TWBR
+ uint8_t twbrbackup = TWBR;
+ TWBR = 18; // upgrade to 400KHz!
+#endif
#ifndef MEMORY_SAVING
if (m_font == FONT_SIZE_SMALL) {
#endif
@@ -385,14 +387,18 @@ size_t LCD_SSD1306::write(uint8_t c)
}
}
#endif
+#ifdef TWBR
TWBR = twbrbackup;
+#endif
return 1;
}
void LCD_SSD1306::writeDigit(byte n)
{
+#ifdef TWBR
uint8_t twbrbackup = TWBR;
TWBR = 18; // upgrade to 400KHz!
+#endif
if (m_font == FONT_SIZE_SMALL) {
Wire.beginTransmission(_i2caddr);
Wire.write(0x40);
@@ -542,7 +548,9 @@ void LCD_SSD1306::writeDigit(byte n)
}
m_col += (m_flags & FLAG_PIXEL_DOUBLE_H) ? 30 : 16;
}
+#ifdef TWBR
TWBR = twbrbackup;
+#endif
}
void LCD_SSD1306::draw(const PROGMEM byte* buffer, byte width, byte height)
@@ -551,13 +559,13 @@ void LCD_SSD1306::draw(const PROGMEM byte* buffer, byte width, byte height)
ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
- // save I2C bitrate
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-
const PROGMEM byte *p = buffer;
height >>= 3;
width >>= 3;
+#ifdef TWBR
+ uint8_t twbrbackup = TWBR;
+ TWBR = 18; // upgrade to 400KHz!
+#endif
for (byte i = 0; i < height; i++) {
// send a bunch of data in one xmission
ssd1306_command(0xB0 + i + m_row);//set page address
@@ -573,8 +581,10 @@ void LCD_SSD1306::draw(const PROGMEM byte* buffer, byte width, byte height)
Wire.endTransmission();
}
}
- TWBR = twbrbackup;
m_col += width;
+#ifdef TWBR
+ TWBR = twbrbackup;
+#endif
}
void LCD_SSD1306::clearLine(byte line)
@@ -583,9 +593,10 @@ void LCD_SSD1306::clearLine(byte line)
ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
- // save I2C bitrate
+#ifdef TWBR
uint8_t twbrbackup = TWBR;
TWBR = 18; // upgrade to 400KHz!
+#endif
// send a bunch of data in one xmission
ssd1306_command(0xB0 + line);//set page address
@@ -600,8 +611,9 @@ void LCD_SSD1306::clearLine(byte line)
}
Wire.endTransmission();
}
-
+#ifdef TWBR
TWBR = twbrbackup;
+#endif
}
void LCD_SSD1306::clear(byte x, byte y, byte width, byte height)
@@ -610,13 +622,13 @@ void LCD_SSD1306::clear(byte x, byte y, byte width, byte height)
ssd1306_command(SSD1306_SETHIGHCOLUMN | 0x0); // hi col = 0
ssd1306_command(SSD1306_SETSTARTLINE | 0x0); // line #0
- // save I2C bitrate
- uint8_t twbrbackup = TWBR;
- TWBR = 18; // upgrade to 400KHz!
-
height >>= 3;
width >>= 3;
y >>= 3;
+#ifdef TWBR
+ uint8_t twbrbackup = TWBR;
+ TWBR = 18; // upgrade to 400KHz!
+#endif
for (byte i = 0; i < height; i++) {
// send a bunch of data in one xmission
ssd1306_command(0xB0 + i + y);//set page address
@@ -632,7 +644,14 @@ void LCD_SSD1306::clear(byte x, byte y, byte width, byte height)
Wire.endTransmission();
}
}
-
- setCursor(0, 0);
+#ifdef TWBR
TWBR = twbrbackup;
+#endif
+ setCursor(0, 0);
+}
+
+void LCD_SSD1306::setContrast(byte Contrast)
+{
+ ssd1306_command(SSD1306_SETCONTRAST);
+ ssd1306_command(Contrast);
}
diff --git a/nanologger/MicroLCD.h b/nanologger/MicroLCD.h
index e421505..51781ab 100644
--- a/nanologger/MicroLCD.h
+++ b/nanologger/MicroLCD.h
@@ -1,13 +1,14 @@
/*************************************************************************
-* Arduino Text Display Library for Multiple LCDs
+* Arduino Text & Bitmap Display Library for multiple models of monochrome LCD display
* Distributed under GPL v2.0
-* Copyright (c) 2013 Stanley Huang <stanleyhuangyc@live.com>
+* Copyright (c) 2013-2014 Stanley Huang <stanleyhuangyc@gmail.com>
* All rights reserved.
+* For more information, please visit http://arduinodev.com
*************************************************************************/
-#if !defined(__AVR_ATmega2560__) && !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega644P__)
+#include <Arduino.h>
+
//#define MEMORY_SAVING
-#endif
typedef enum {
FONT_SIZE_SMALL = 0,
@@ -32,10 +33,10 @@ class LCD_Common
{
public:
LCD_Common():m_font(FONT_SIZE_SMALL),m_flags(0) {}
- void setFont(FONT_SIZE size) { m_font = size; }
+ void setFontSize(FONT_SIZE size) { m_font = size; }
void setFlags(byte flags) { m_flags = flags; }
virtual void backlight(bool on) {}
- virtual void draw(const PROGMEM byte* buffer, byte x, byte y, byte width, byte height) {}
+ virtual void draw(const PROGMEM byte* buffer, byte width, byte height) {}
void printInt(uint16_t value, int8_t padding = -1);
void printLong(uint32_t value, int8_t padding = -1);
protected:
@@ -62,6 +63,7 @@ class LCD_SSD1306 : public LCD_Common, public SSD1306, public Print
{
public:
void setCursor(byte column, byte line);
+ void setContrast(byte Contrast);
void draw(const PROGMEM byte* buffer, byte width, byte height);
size_t write(uint8_t c);
void clear(byte x = 0, byte y = 0, byte width = 128, byte height = 64);
@@ -92,3 +94,26 @@ private:
byte m_col;
byte m_row;
};
+
+#include "PCD8544.h"
+
+class LCD_PCD8544 : public LCD_Common, public PCD8544
+{
+public:
+ byte getLines() { return 6; }
+ byte getCols() { return 14; }
+ void backlight(bool on)
+ {
+ pinMode(7, OUTPUT);
+ digitalWrite(7, on ? HIGH : LOW);
+ }
+ void clearLine(byte line)
+ {
+ setCursor(0, line);
+ for (byte i = 14; i > 0; i--) write(' ');
+ }
+ void draw(const PROGMEM byte* buffer, byte width, byte height);
+private:
+ void writeDigit(byte n);
+};
+
diff --git a/nanologger/nanologger.cbp b/nanologger/nanologger.cbp
index c45b7ad..6024094 100644
--- a/nanologger/nanologger.cbp
+++ b/nanologger/nanologger.cbp
@@ -98,42 +98,6 @@
<Variable name="UPLOAD_PORT" value="" />
</Environment>
</Target>
- <Target title="Arduino Esplora">
- <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega32U4__" />
- <Add option="-DUSB_VID=0x2341" />
- <Add option="-DUSB_PID=0x8037" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/leonardo" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Esplora" />
- <Variable name="BOARD_ID" value="esplora" />
- <Variable name="MCU" value="atmega32u4" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="57600" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
<Target title="Arduino Micro">
<Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
<Option type="1" />
@@ -204,40 +168,6 @@
<Variable name="UPLOAD_PORT" value="" />
</Environment>
</Target>
- <Target title="Arduino Duemilanove (168)">
- <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega168__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Duemilanove (168)" />
- <Variable name="BOARD_ID" value="duemilanove168" />
- <Variable name="MCU" value="atmega168" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
<Target title="Arduino Nano (328)">
<Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
<Option type="1" />
@@ -272,40 +202,6 @@
<Variable name="UPLOAD_PORT" value="" />
</Environment>
</Target>
- <Target title="Arduino Nano (168)">
- <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega168__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Nano (168)" />
- <Variable name="BOARD_ID" value="nano168" />
- <Variable name="MCU" value="atmega168" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
<Target title="Arduino Mini (328)">
<Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
<Option type="1" />
@@ -340,40 +236,6 @@
<Variable name="UPLOAD_PORT" value="" />
</Environment>
</Target>
- <Target title="Arduino Mini (168)">
- <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega168__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/eightanaloginputs" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Mini (168)" />
- <Variable name="BOARD_ID" value="mini168" />
- <Variable name="MCU" value="atmega168" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
<Target title="Arduino Pro Mini (328)">
<Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
<Option type="1" />
@@ -408,40 +270,6 @@
<Variable name="UPLOAD_PORT" value="" />
</Environment>
</Target>
- <Target title="Arduino Pro Mini (168)">
- <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega168__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Pro Mini (168)" />
- <Variable name="BOARD_ID" value="promini168" />
- <Variable name="MCU" value="atmega168" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
<Target title="Arduino Mega 2560/ADK">
<Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
<Option type="1" />
@@ -510,74 +338,6 @@
<Variable name="UPLOAD_PORT" value="" />
</Environment>
</Target>
- <Target title="Arduino Mega 8">
- <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega328P__" />
- <Add option="-Os" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Arduino Mega 8" />
- <Variable name="BOARD_ID" value="mega8" />
- <Variable name="MCU" value="atmega8" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="19200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
- <Target title="Microduino Core+ (644P)">
- <Option output="bin/Release/obdlogger_${BOARD_ID}.elf" prefix_auto="1" extension_auto="0" />
- <Option type="1" />
- <Option compiler="avrgcc" />
- <Compiler>
- <Add option="-O3" />
- <Add option="-x c++" />
- <Add option="-mmcu=$(MCU)" />
- <Add option="-DF_CPU=16000000L" />
- <Add option="-D__AVR_ATmega644P__" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
- <Add directory="$(ARDUINO_DIR)/libraries" />
- <Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/plus" />
- </Compiler>
- <Linker>
- <Add option="-mmcu=$(MCU)" />
- <Add option='&quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add option='&quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- </Linker>
- <ExtraCommands>
- <Add before='$(TARGET_COMPILER_DIR)ArduinoUploader &quot;$(PROJECT_DIR).&quot; $(BOARD_ID) - $(MCU_CLOCK) 0 &quot;$(PROJECT_DIR)bin/lib_${BOARD_ID}_${MCU_CLOCK}.a&quot; &quot;$(PROJECT_DIR)bin/core_${BOARD_ID}_${MCU_CLOCK}.a&quot;' />
- <Add after='avr-objcopy -O ihex -R .eeprom -R .eesafe &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).hex&quot;' />
- <Add after='avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex &quot;$(TARGET_OUTPUT_FILE)&quot; &quot;$(TARGET_OUTPUT_FILE).eep.hex&quot;' />
- <Add after='avr-size --mcu=$(MCU) --format=avr &quot;$(TARGET_OUTPUT_FILE)&quot;' />
- </ExtraCommands>
- <Environment>
- <Variable name="BOARD" value="Microduino Core+ (644P)" />
- <Variable name="BOARD_ID" value="uduino644p" />
- <Variable name="MCU" value="atmega644p" />
- <Variable name="MCU_CLOCK" value="16" />
- <Variable name="UPLOAD_BAUDRATE" value="115200" />
- <Variable name="UPLOAD_PORT" value="" />
- </Environment>
- </Target>
</Build>
<Compiler>
<Add directory="." />
@@ -595,6 +355,7 @@
<Extensions>
<code_completion />
<debugger />
+ <envvars />
</Extensions>
</Project>
</CodeBlocks_project_file>
diff --git a/nanologger/nanologger.depend b/nanologger/nanologger.depend
deleted file mode 100644
index 6f4664c..0000000
--- a/nanologger/nanologger.depend
+++ /dev/null
@@ -1,71 +0,0 @@
-# depslib dependency file v1.0
-1394256987 source:e:\arduino\arduinoobd\nanologger\microlcd.cpp
- <Arduino.h>
- <Wire.h>
- "MicroLCD.h"
-
-1371033101 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\arduino.h
- <stdlib.h>
- <string.h>
- <math.h>
- <avr/pgmspace.h>
- <avr/io.h>
- <avr/interrupt.h>
- "binary.h"
- "WCharacter.h"
- "WString.h"
- "HardwareSerial.h"
- "pins_arduino.h"
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\binary.h
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\wcharacter.h
- <ctype.h>
-
-1371033133 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\wstring.h
- <stdlib.h>
- <string.h>
- <ctype.h>
- <avr/pgmspace.h>
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\hardwareserial.h
- <inttypes.h>
- "Stream.h"
- "USBAPI.h"
-
-1371032829 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\stream.h
- <inttypes.h>
- "Print.h"
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\print.h
- <inttypes.h>
- <stdio.h>
- "WString.h"
- "Printable.h"
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\printable.h
- <new.h>
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\new.h
- <stdlib.h>
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\cores\arduino\usbapi.h
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\variants\eightanaloginputs\pins_arduino.h
- "../standard/pins_arduino.h"
-
-1362986950 d:\apps\codeblocks\arduino\hardware\arduino\variants\standard\pins_arduino.h
- <avr/pgmspace.h>
-
-1394121163 e:\arduino\arduinoobd\nanologger\microlcd.h
- "SSD1306.h"
-
-1371132197 e:\arduino\arduinoobd\nanologger\ssd1306.h
- "Arduino.h"
- "WProgram.h"
-
-1394121227 source:e:\arduino\arduinoobd\nanologger\sh1106.cpp
- <Arduino.h>
- <Wire.h>
- "MicroLCD.h"
-
diff --git a/nanologger/nanologger.ino b/nanologger/nanologger.ino
index ae6195a..0a4ef0f 100644
--- a/nanologger/nanologger.ino
+++ b/nanologger/nanologger.ino
@@ -72,7 +72,7 @@ public:
#if ENABLE_DATA_LOG
uint16_t index = openFile();
- lcd.setFont(FONT_SIZE_SMALL);
+ lcd.setFontSize(FONT_SIZE_SMALL);
lcd.setCursor(86, 0);
if (index) {
lcd.write('[');
@@ -120,7 +120,7 @@ public:
// display distance travelled (GPS)
char buf[10];
sprintf(buf, "%4ukm", (uint16_t)(distance / 1000));
- lcd.setFont(FONT_SIZE_SMALL);
+ lcd.setFontSize(FONT_SIZE_SMALL);
lcd.setCursor(92, 6);
lcd.print(buf);
@@ -138,7 +138,7 @@ public:
// display logged data size
char buf[7];
sprintf(buf, "%4uKB", (int)(dataSize >> 10));
- lcd.setFont(FONT_SIZE_SMALL);
+ lcd.setFontSize(FONT_SIZE_SMALL);
lcd.setCursor(92, 7);
lcd.print(buf);
}
@@ -246,7 +246,7 @@ private:
closeFile();
#endif
lcd.clear();
- lcd.setFont(FONT_SIZE_MEDIUM);
+ lcd.setFontSize(FONT_SIZE_MEDIUM);
lcd.print("Reconnecting");
startTime = millis();
state &= ~(STATE_OBD_READY | STATE_ACC_READY);
@@ -277,7 +277,7 @@ private:
// screen layout related stuff
void showStates()
{
- lcd.setFont(FONT_SIZE_MEDIUM);
+ lcd.setFontSize(FONT_SIZE_MEDIUM);
lcd.setCursor(0, 4);
lcd.print("OBD ");
showTickCross(state & STATE_OBD_READY);
@@ -291,26 +291,26 @@ private:
switch (pid) {
case PID_RPM:
lcd.setCursor(64, 0);
- lcd.setFont(FONT_SIZE_XLARGE);
+ lcd.setFontSize(FONT_SIZE_XLARGE);
lcd.printInt((unsigned int)value % 10000, 4);
break;
case PID_SPEED:
if (lastSpeed != value) {
lcd.setCursor(0, 0);
- lcd.setFont(FONT_SIZE_XLARGE);
+ lcd.setFontSize(FONT_SIZE_XLARGE);
lcd.printInt((unsigned int)value % 1000, 3);
lastSpeed = value;
}
break;
case PID_THROTTLE:
lcd.setCursor(24, 5);
- lcd.setFont(FONT_SIZE_SMALL);
+ lcd.setFontSize(FONT_SIZE_SMALL);
lcd.printInt(value % 100, 3);
break;
case PID_INTAKE_TEMP:
if (value < 1000) {
lcd.setCursor(102, 5);
- lcd.setFont(FONT_SIZE_SMALL);
+ lcd.setFontSize(FONT_SIZE_SMALL);
lcd.printInt(value, 3);
}
break;
@@ -349,7 +349,7 @@ private:
{
lcd.clear();
lcd.backlight(true);
- lcd.setFont(FONT_SIZE_SMALL);
+ lcd.setFontSize(FONT_SIZE_SMALL);
lcd.setCursor(24, 3);
lcd.print("km/h");
lcd.setCursor(110, 3);
@@ -366,14 +366,14 @@ static COBDLogger logger;
void setup()
{
lcd.begin();
- lcd.setFont(FONT_SIZE_MEDIUM);
+ lcd.setFontSize(FONT_SIZE_MEDIUM);
lcd.println("NanoLogger");
logger.begin();
logger.initSender();
#if ENABLE_DATA_LOG
- lcd.setFont(FONT_SIZE_MEDIUM);
+ lcd.setFontSize(FONT_SIZE_MEDIUM);
lcd.setCursor(0, 2);
logger.checkSD();
#endif