Skip to content

Commit

Permalink
Stable release : 3.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaultier committed Feb 9, 2015
1 parent 4743b6d commit 44983eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 80 deletions.
56 changes: 6 additions & 50 deletions laboite.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/*
<<<<<<< HEAD
laboite v3.2.1
=======
laboite v3.4
>>>>>>> c3c665790d59ad9bfa378865b6d49acffc89cd74
laboite v3.2.23.2.2
This Arduino firmware is part of laboite project https://laboite.cc/help
It is a connected device displaying a lot of information (A LOT !) coming from an
Internet server with a laboite web app deployed (e.g. https://laboite.cc/ ).
Expand Down Expand Up @@ -42,7 +38,7 @@
*/
// uncomment if you want to enable debug
#define DEBUG
//#define DEBUG
// uncomment if you want to enable Ethernet
#define ETHERNET
// uncomment if you want to enable dotmatrix
Expand All @@ -53,11 +49,6 @@
//#define SENSORS
// uncomment if you want to enable the AVR Watchdog
//#define WATCHDOG
<<<<<<< HEAD
=======
// uncomment if you are uploading to a Arduino MEGA
//#define MEGA
>>>>>>> c3c665790d59ad9bfa378865b6d49acffc89cd74

#ifdef ETHERNET
#include <SPI.h>
Expand Down Expand Up @@ -90,7 +81,7 @@ EthernetClient client;
const int requestInterval = 16000; // delay between requests

char serverName[] = "api.laboite.cc"; // your favorite API server running laboite-webapp https://github.com/bgaultier/laboite-webapp
char apikey[] = "c859fd5a"; // your device API key
char apikey[] = "964de680"; // your device API key

String currentLine = ""; // string to hold the text from server

Expand All @@ -100,7 +91,6 @@ char minutes[3];
char bus[3];
char bikes[3];
char emails[3];
char coffees[3];
byte todayIcon;
byte tomorrowIcon;
byte color;
Expand Down Expand Up @@ -148,10 +138,8 @@ boolean busEnabled = false;
boolean bikesEnabled = false;
boolean emailsEnabled = false;
boolean weatherEnabled = false;
boolean coffeesEnabled = false;
boolean energyEnabled = false;
boolean messagesEnabled = false;
boolean agendaEnabled = false;

#ifdef TINKERKIT
TKLightSensor ldr(I0); // ldr used to adjust dotmatrix brightness
Expand All @@ -168,21 +156,10 @@ const byte buttonPin = A2; // pushbutton used to start/stop scrolling
#endif

#ifdef HT1632C
<<<<<<< HEAD
// initialize the dotmatrix with the numbers of the interface pins (data→7, wr→6, clk→4, cs→5)
//ht1632c dotmatrix = ht1632c(&PORTD, 7, 6, 4, 5, GEOM_32x16, 2);
// uncomment if you are using an Arduino MEGA
ht1632c dotmatrix = ht1632c(&PORTA, 0, 1, 3, 2, GEOM_32x16, 2);
=======
// initialize the dotmatrix with the numbers of the interface pins (data:7, wr:6, clk:4, cs:5)
#ifndef MEGA
ht1632c dotmatrix = ht1632c(&PORTD, 7, 6, 4, 5, GEOM_32x16, 2);
#endif
#ifdef MEGA
// initialize the dotmatrix with the numbers of the MEGA interface pins (data:22, wr:23, clk:25, cs:24)
ht1632c dotmatrix = ht1632c(&PORTA, 0, 1, 3, 2, GEOM_32x16, 2);
#endif
>>>>>>> c3c665790d59ad9bfa378865b6d49acffc89cd74
// uncomment if you are using an Arduino MEGA
//ht1632c dotmatrix = ht1632c(&PORTA, 0, 1, 3, 2, GEOM_32x16, 2);

// weather app sprites:
uint16_t sprites[5][9] =
Expand All @@ -199,8 +176,6 @@ uint16_t busSprite[9] = { 0x00fc, 0x0186, 0x01fe, 0x0102, 0x0102, 0x01fe, 0x017a
uint16_t bikeSprite[9] = { 0x020c, 0x0102, 0x008c, 0x00f8, 0x078e, 0x0ab9, 0x0bd5, 0x0891, 0x070e};
// emails app sprite:
uint16_t emailSprite[6] = { 0x00fe, 0x0145, 0x0129, 0x0111, 0x0101, 0x00fe};
// coffees app sprite
uint16_t coffeeSprite[8] = {0x4800, 0x2400, 0x4800, 0xff00, 0x8500, 0x8600, 0x8400, 0x7800};

int brightnessValue = 0; // value read from the LDR
int previousBrightnessValue = 512; // previous value of brightness
Expand All @@ -221,37 +196,18 @@ void setup() {

// display a welcome message:
#ifdef DEBUG
<<<<<<< HEAD
Serial.println("laboite v3.2.1 starting...");
=======
Serial.println("laboite v3.4 starting...");
>>>>>>> c3c665790d59ad9bfa378865b6d49acffc89cd74
Serial.println("laboite v3.2.2 starting...");
#endif

// attempt a DHCP connection:
#ifdef ETHERNET
<<<<<<< HEAD
=======
#ifndef MEGA
Ethernet.begin(mac, ip, dns, gateway);
#ifdef DEBUG
Serial.println("Using DHCP increases the sketch size significantly so we have to specify an IP adress manually.");
#endif
#endif

#ifdef MEGA
>>>>>>> c3c665790d59ad9bfa378865b6d49acffc89cd74
if (!Ethernet.begin(mac)) {
// if DHCP fails, start with a hard-coded address:
#ifdef DEBUG
Serial.println("failed to get an IP address using DHCP, trying manually");
#endif
Ethernet.begin(mac, ip, subnet);
}
<<<<<<< HEAD
=======
#endif
>>>>>>> c3c665790d59ad9bfa378865b6d49acffc89cd74
#endif

#ifdef DEBUG
Expand Down
32 changes: 2 additions & 30 deletions laboiteLib.ino
Original file line number Diff line number Diff line change
Expand Up @@ -158,32 +158,6 @@ boolean parseJSON() {
}
}

// fetch Coffees app data
if (currentLine.endsWith("\"coffees\":")) {
readingCoffees = true;
content = "";
}

if (readingCoffees) {
if (inChar != ',' && inChar != '}') {
if (inChar != '"' && inChar != ':')
content += inChar;
}
else {
readingCoffees = false;
coffees[0] = content.charAt(0);
coffees[1] = content.charAt(1);
coffees[2] = '\0';

coffeesEnabled = true;

#ifdef DEBUG
Serial.print("Coffees: ");
Serial.println(coffees);
#endif
}
}

// fetch Energy app data
if (currentLine.endsWith("\"day0\":")) {
readingDay0 = true;
Expand Down Expand Up @@ -443,10 +417,8 @@ void resetApps() {
bikesEnabled = false;
emailsEnabled = false;
weatherEnabled = false;
coffeesEnabled = false;
energyEnabled = false;
messagesEnabled = false;
agendaEnabled = false;
}

int stringToInt(String string) {
Expand Down Expand Up @@ -525,7 +497,7 @@ void scrollFirstPanel(int x) {
}

if(x == 0) {
#ifdef SENSORS
#ifdef SENSOR
#ifdef TINKERKIT
waitAWhile();
printTemperature(x+17, indoorTemperatureString[0], indoorTemperatureString[1], ORANGE);
Expand All @@ -550,7 +522,7 @@ void scrollSecondPanel(int x) {
}

if(x >= -32 && x < 0) {
#ifdef SENSORS
#ifdef SENSOR
printTemperature(x+17, indoorTemperatureString[0], indoorTemperatureString[1], ORANGE);
#else
printTemperature(x+17, temperature[0], temperature[1], RED);
Expand Down

0 comments on commit 44983eb

Please sign in to comment.