Skip to content

Commit

Permalink
20200107
Browse files Browse the repository at this point in the history
  • Loading branch information
ch570512 committed Jan 7, 2020
1 parent 8df8233 commit cf82517
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 81 deletions.
5 changes: 4 additions & 1 deletion Colors.h
Expand Up @@ -2,7 +2,8 @@
Colors.h
******************************************************************************/

#pragma once
#ifndef COLORS_H
#define COLORS_H

enum eColorChange : uint8_t
{
Expand Down Expand Up @@ -90,3 +91,5 @@ const color_s defaultColors[] =

{ 0xFF, 0x00, 0x7F } // 24 PINK
};

#endif
15 changes: 11 additions & 4 deletions Configuration.h
Expand Up @@ -3,7 +3,8 @@
// See README.txt for help
//******************************************************************************

#pragma once
#ifndef CONFIGURATION_H
#define CONFIGURATION_H

//******************************************************************************
// Software settings
Expand Down Expand Up @@ -98,6 +99,10 @@

#define SERIAL_SPEED 115200

//#define ONOFF_BUTTON
//#define MODE_BUTTON
//#define TIME_BUTTON

#define NUMPIXELS 114
#define ESP_LED

Expand Down Expand Up @@ -159,14 +164,16 @@
#define PIN_IR_RECEIVER 16 // D0 (no interrupt)
//#define PIN_WIRE_SCL 05 // D1 SCL
//#define PIN_WIRE_SDA 04 // D2 SDA
//#define none 00 // D3 LOW_Flash
#define PIN_MODE_BUTTON 00 // D3 LOW_Flash
#define PIN_LED 02 // D4 ESP8266_LED
#define PIN_BUZZER 14 // D5
#define PIN_DHT22 12 // D6
#define PIN_LEDS_CLOCK 13 // D7
#define PIN_LEDS_DATA 15 // D8
#define PIN_LDR A0 // ADC
//#define none 01 // TXD0
//#define none 03 // RXD0
#define PIN_TIME_BUTTON 01 // TXD0
#define PIN_ONOFF_BUTTON 03 // RXD0
// GPIO 06 to GPIO 11 are
// used for flash memory databus

#endif
5 changes: 4 additions & 1 deletion Events.h
Expand Up @@ -2,7 +2,8 @@
Events.h
******************************************************************************/

#pragma once
#ifndef EVENTS_H
#define EVENTS_H

struct event_t
{
Expand All @@ -21,3 +22,5 @@ event_t events[] =
{ 12, 24, "It's Christmas!", 0, RED },
{ 3, 12, "Qlockworks birthday!", 2017, MAGENTA }
};

#endif
5 changes: 4 additions & 1 deletion Languages.h
Expand Up @@ -2,7 +2,8 @@
Languages.h
******************************************************************************/

#pragma once
#ifndef LANGUAGES_H
#define LANGUAGES_H

//enum eLanguage : uint8_t
//{
Expand Down Expand Up @@ -128,3 +129,5 @@ const char sWeekday[][2] =
{ 'Z', 'A' } // 07
};
#endif

#endif
5 changes: 4 additions & 1 deletion LedDriver.h
Expand Up @@ -2,7 +2,8 @@
// LedDriver.h
//******************************************************************************

#pragma once
#ifndef LEDDRIVER_H
#define LEDDRIVER_H

#include <Adafruit_NeoPixel.h>
#include "Configuration.h"
Expand All @@ -23,3 +24,5 @@ class LedDriver
Adafruit_NeoPixel *strip;

};

#endif
19 changes: 11 additions & 8 deletions Letters.h
Expand Up @@ -2,7 +2,8 @@
Letters.h
******************************************************************************/

#pragma once
#ifndef LETTERS_H
#define LETTERS_H

const char letters[][5] =
{
Expand Down Expand Up @@ -255,9 +256,9 @@ const char lettersBig[][7] =
{ 0x11, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x11 }, // ASCII-Code 0x58 => X (88)
{ 0x11, 0x11, 0x11, 0x0a, 0x04, 0x04, 0x04 }, // ASCII-Code 0x59 => Y (89)
{ 0x1f, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1f }, // ASCII-Code 0x5A => Z (90)
{ 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c }, // ASCII-Code 0x5B => [ (91) Ä
{ 0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00 }, // ASCII-Code 0x5C => \ (92) Ö
{ 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x1c }, // ASCII-Code 0x5D => ] (93) Ü
{ 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c }, // ASCII-Code 0x5B => [ (91)
{ 0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00 }, // ASCII-Code 0x5C => \ (92)
{ 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x1c }, // ASCII-Code 0x5D => ] (93)
{ 0x04, 0x0a, 0x11, 0x00, 0x00, 0x00, 0x00 }, // ASCII-Code 0x5E => ^ (94)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f }, // ASCII-Code 0x5F => _ (95)
{ 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00 }, // ASCII-Code 0x60 => ` (96)
Expand Down Expand Up @@ -287,8 +288,10 @@ const char lettersBig[][7] =
{ 0x00, 0x00, 0x11, 0x0a, 0x04, 0x0a, 0x11 }, // ASCII-Code 0x78 => x (120)
{ 0x00, 0x00, 0x11, 0x11, 0x0f, 0x01, 0x0e }, // ASCII-Code 0x79 => y (121)
{ 0x00, 0x00, 0x1f, 0x02, 0x04, 0x08, 0x1f }, // ASCII-Code 0x7A => z (122)
{ 0x04, 0x08, 0x08, 0x10, 0x08, 0x08, 0x04 }, // ASCII-Code 0x7B => { (123) ä
{ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 }, // ASCII-Code 0x7C => | (124) ö
{ 0x10, 0x08, 0x08, 0x04, 0x08, 0x08, 0x10 }, // ASCII-Code 0x7D => } (125) ü
{ 0x00, 0x00, 0x00, 0x19, 0x26, 0x00, 0x00 } // ASCII-Code 0x7E => ~ (126) ß
{ 0x04, 0x08, 0x08, 0x10, 0x08, 0x08, 0x04 }, // ASCII-Code 0x7B => { (123)
{ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 }, // ASCII-Code 0x7C => | (124)
{ 0x10, 0x08, 0x08, 0x04, 0x08, 0x08, 0x10 }, // ASCII-Code 0x7D => } (125)
{ 0x00, 0x00, 0x00, 0x19, 0x26, 0x00, 0x00 } // ASCII-Code 0x7E => ~ (126)
};

#endif
5 changes: 4 additions & 1 deletion Modes.h
Expand Up @@ -2,7 +2,8 @@
// Modes.h
//******************************************************************************

#pragma once
#ifndef MODES_H
#define MODES_H

typedef enum eMode : uint8_t
{
Expand Down Expand Up @@ -61,3 +62,5 @@ enum eTransition
TRANSITION_MOVEUP, // 1
TRANSITION_FADE // 2
};

#endif
5 changes: 4 additions & 1 deletion Ntp.h
Expand Up @@ -2,7 +2,8 @@
// Ntp.h - Get UTC time from NTP
//******************************************************************************

#pragma once
#ifndef NTP_H
#define NTP_H

#include <ESP8266WiFi.h>
#include <TimeLib.h>
Expand All @@ -19,3 +20,5 @@ class Ntp
private:

};

#endif
5 changes: 4 additions & 1 deletion Numbers.h
Expand Up @@ -2,7 +2,8 @@
Numbers.h
******************************************************************************/

#pragma once
#ifndef NUMBERS_H
#define NUMBERS_H

const char numbers[][5] =
{
Expand Down Expand Up @@ -181,3 +182,5 @@ const char numbersBig[][7] =
0b00001100
}
};

#endif
5 changes: 4 additions & 1 deletion OpenWeather.h
Expand Up @@ -2,7 +2,8 @@
// OpenWeather.h - Get weather data from OpenWeather
//******************************************************************************

#pragma once
#ifndef OPENWEATHER_H
#define OPENWEATHER_H

#include <Arduino_JSON.h>
#include <ESP8266WiFi.h>
Expand All @@ -23,3 +24,5 @@ class OpenWeather
private:

};

#endif
114 changes: 58 additions & 56 deletions Qlockwork.ino
Expand Up @@ -20,7 +20,7 @@
//
// ******************************************************************************

#define FIRMWARE_VERSION 20200106
#define FIRMWARE_VERSION 20200107

#include <Arduino.h>
#include <Arduino_JSON.h>
Expand Down Expand Up @@ -207,23 +207,23 @@ void setup()
digitalWrite(PIN_LED, HIGH);
#endif

//#ifdef MODE_BUTTON
// Serial.println("Setting up Mode-Button.");
// pinMode(PIN_MODE_BUTTON, INPUT_PULLUP);
// attachInterrupt(PIN_MODE_BUTTON, buttonModeInterrupt, FALLING);
//#endif
//
//#ifdef ONOFF_BUTTON
// Serial.println("Setting up Back-Button.");
// pinMode(PIN_ONOFF_BUTTON, INPUT_PULLUP);
// attachInterrupt(PIN_ONOFF_BUTTON, buttonOnOffInterrupt, FALLING);
//#endif
//
//#ifdef TIME_BUTTON
// Serial.println("Setting up Time-Button.");
// pinMode(PIN_TIME_BUTTON, INPUT_PULLUP);
// attachInterrupt(PIN_TIME_BUTTON, buttonTimeInterrupt, FALLING);
//#endif
#ifdef MODE_BUTTON
Serial.println("Setting up Mode-Button.");
pinMode(PIN_MODE_BUTTON, INPUT_PULLUP);
attachInterrupt(PIN_MODE_BUTTON, buttonModeInterrupt, FALLING);
#endif

#ifdef ONOFF_BUTTON
Serial.println("Setting up Back-Button.");
pinMode(PIN_ONOFF_BUTTON, INPUT_PULLUP);
attachInterrupt(PIN_ONOFF_BUTTON, buttonOnOffInterrupt, FALLING);
#endif

#ifdef TIME_BUTTON
Serial.println("Setting up Time-Button.");
pinMode(PIN_TIME_BUTTON, INPUT_PULLUP);
attachInterrupt(PIN_TIME_BUTTON, buttonTimeInterrupt, FALLING);
#endif

#ifdef BUZZER
Serial.println("Setting up Buzzer.");
Expand Down Expand Up @@ -328,9 +328,11 @@ void setup()

// Get weather from OpenWeather
#ifdef APIKEY
#ifdef DEBUG
Serial.println("Getting outdoor weather:");
#endif
!outdoorWeather.getOutdoorConditions(LOCATION, APIKEY) ? errorCounterOutdoorWeather++ : errorCounterOutdoorWeather = 0;
#ifdef DEBUG
Serial.println("Outdoor weather:");
Serial.println(outdoorWeather.description);
Serial.println(outdoorWeather.temperature);
Serial.println(outdoorWeather.humidity);
Expand Down Expand Up @@ -1495,38 +1497,38 @@ void getRoomConditions()
// Misc
//******************************************************************************

//#ifdef MODE_BUTTON
//void buttonModeInterrupt()
//{
// if (millis() > lastButtonPress + 250)
// {
// lastButtonPress = millis();
// buttonModePressed();
// }
//}
//#endif
//
//#ifdef ONOFF_BUTTON
//void buttonOnOffInterrupt()
//{
// if (millis() > lastButtonPress + 250)
// {
// lastButtonPress = millis();
// buttonOnOffPressed();
// }
//}
//#endif
//
//#ifdef TIME_BUTTON
//void buttonTimeInterrupt()
//{
// if (millis() > lastButtonPress + 250)
// {
// lastButtonPress = millis();
// buttonTimePressed();
// }
//}
//#endif
#ifdef MODE_BUTTON
void buttonModeInterrupt()
{
if (millis() > lastButtonPress + 250)
{
lastButtonPress = millis();
buttonModePressed();
}
}
#endif

#ifdef ONOFF_BUTTON
void buttonOnOffInterrupt()
{
if (millis() > lastButtonPress + 250)
{
lastButtonPress = millis();
buttonOnOffPressed();
}
}
#endif

#ifdef TIME_BUTTON
void buttonTimeInterrupt()
{
if (millis() > lastButtonPress + 250)
{
lastButtonPress = millis();
buttonTimePressed();
}
}
#endif

// Switch off LEDs
void setLedsOff()
Expand Down Expand Up @@ -1766,11 +1768,11 @@ void handleRoot()
#else
message += "<s>ESP_LED</s> ";
#endif
//#if defined(ONOFF_BUTTON) || defined(MODE_BUTTON) || defined(TIME_BUTTON)
// message += "BUTTONS ";
//#else
// message += "<s>BUTTONS</s> ";
//#endif
#if defined(ONOFF_BUTTON) || defined(MODE_BUTTON) || defined(TIME_BUTTON)
message += "BUTTONS ";
#else
message += "<s>BUTTONS</s> ";
#endif
#endif
message += "</span></body></html>";
webServer.send(200, "text/html", message);
Expand Down
2 changes: 1 addition & 1 deletion Readme.txt
Expand Up @@ -97,7 +97,7 @@ White
Needed libraries: (recommended versions in brackets)
******************************************************************************

esp8266 by ESP8266 Community (2.5.2) <<-- THIS IS IMPORTANT!
esp8266 by ESP8266 Community (2.4.2) <<-- THIS IS IMPORTANT!
Arduino_JSON by Arduino (0.1.0)
Adafruit NeoPixel by Adafruit (1.3.4)
Adafruit Unified Sensor by Adafruit (1.1.1)
Expand Down
5 changes: 4 additions & 1 deletion Renderer.h
Expand Up @@ -2,7 +2,8 @@
Renderer.h
******************************************************************************/

#pragma once
#ifndef RENDERER_H
#define RENDERER_H

#include <Arduino.h>
#include "Configuration.h"
Expand Down Expand Up @@ -49,3 +50,5 @@ class Renderer
void ES_hours(uint8_t hours, uint16_t matrix[]);
#endif
};

#endif
5 changes: 4 additions & 1 deletion Settings.h
Expand Up @@ -2,7 +2,8 @@
// Settings.h
//******************************************************************************

#pragma once
#ifndef SETTINGS_H
#define SETTINGS_H

#include <Arduino.h>
#include <EEPROM.h>
Expand Down Expand Up @@ -49,3 +50,5 @@ class Settings
void resetToDefault();
void loadFromEEPROM();
};

#endif

0 comments on commit cf82517

Please sign in to comment.