Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
048167311d | ||
|
|
976095f3ef | ||
|
|
61d36940d9 | ||
|
|
8069dde82f |
@@ -74,14 +74,22 @@ extern "C" {
|
|||||||
#define BLINK_LED_MS 50 // 50 ms blink
|
#define BLINK_LED_MS 50 // 50 ms blink
|
||||||
#define RGB_LED_PIN 14
|
#define RGB_LED_PIN 14
|
||||||
#define RED_LED_PIN 12
|
#define RED_LED_PIN 12
|
||||||
// value for RGB color
|
|
||||||
#define COLOR_RED rgb_brightness, 0, 0
|
// value for HSL color
|
||||||
#define COLOR_ORANGE rgb_brightness, rgb_brightness>>1, 0
|
// see http://www.workwithcolor.com/blue-color-hue-range-01.htm
|
||||||
#define COLOR_YELLOW rgb_brightness, rgb_brightness, 0
|
#define COLOR_RED 0
|
||||||
#define COLOR_GREEN 0, rgb_brightness, 0
|
#define COLOR_ORANGE 30
|
||||||
#define COLOR_CYAN 0, rgb_brightness, rgb_brightness
|
#define COLOR_ORANGE_YELLOW 45
|
||||||
#define COLOR_BLUE 0, 0, rgb_brightness
|
#define COLOR_YELLOW 60
|
||||||
#define COLOR_MAGENTA rgb_brightness, 0, rgb_brightness
|
#define COLOR_YELLOW_GREEN 90
|
||||||
|
#define COLOR_GREEN 120
|
||||||
|
#define COLOR_GREEN_CYAN 165
|
||||||
|
#define COLOR_CYAN 180
|
||||||
|
#define COLOR_CYAN_BLUE 210
|
||||||
|
#define COLOR_BLUE 240
|
||||||
|
#define COLOR_BLUE_MAGENTA 275
|
||||||
|
#define COLOR_MAGENTA 300
|
||||||
|
#define COLOR_PINK 350
|
||||||
|
|
||||||
// GPIO 1 TX on board blue led
|
// GPIO 1 TX on board blue led
|
||||||
#ifdef BLU_LED_PIN
|
#ifdef BLU_LED_PIN
|
||||||
@@ -95,10 +103,11 @@ extern "C" {
|
|||||||
#define LedRedON() {digitalWrite(RED_LED_PIN, 1);}
|
#define LedRedON() {digitalWrite(RED_LED_PIN, 1);}
|
||||||
#define LedRedOFF() {digitalWrite(RED_LED_PIN, 0);}
|
#define LedRedOFF() {digitalWrite(RED_LED_PIN, 0);}
|
||||||
|
|
||||||
// Light off the RGB LED
|
// Light off the RGB LED
|
||||||
#define LedRGBOFF() { rgb_led.SetPixelColor(0,0,0,0); rgb_led.Show(); }
|
#ifndef RGB_LED_PIN
|
||||||
#define LedRGBON(x) { rgb_led.SetPixelColor(0,x); rgb_led.Show(); }
|
#define LedRGBOFF() {}
|
||||||
|
#define LedRGBON(x) {}
|
||||||
|
#endif
|
||||||
// sysinfo informations
|
// sysinfo informations
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -110,7 +119,6 @@ typedef struct
|
|||||||
extern ESP8266WebServer server;
|
extern ESP8266WebServer server;
|
||||||
extern WiFiUDP OTA;
|
extern WiFiUDP OTA;
|
||||||
extern TInfo tinfo;
|
extern TInfo tinfo;
|
||||||
extern NeoPixelBus rgb_led ;
|
|
||||||
extern uint8_t rgb_brightness;
|
extern uint8_t rgb_brightness;
|
||||||
extern unsigned long seconds;
|
extern unsigned long seconds;
|
||||||
extern _sysinfo sysinfo;
|
extern _sysinfo sysinfo;
|
||||||
|
|||||||
@@ -46,11 +46,15 @@ bool ota_blink;
|
|||||||
// Teleinfo
|
// Teleinfo
|
||||||
TInfo tinfo;
|
TInfo tinfo;
|
||||||
|
|
||||||
// RGB Loed
|
// RGB Led
|
||||||
NeoPixelBus rgb_led = NeoPixelBus(1, RGB_LED_PIN, NEO_RGB | NEO_KHZ800);
|
#ifdef RGB_LED_PIN
|
||||||
|
//NeoPixelBus rgb_led = NeoPixelBus(1, RGB_LED_PIN, NEO_RGB | NEO_KHZ800);
|
||||||
|
NeoPixelBus<NeoGrbFeature, NeoEsp8266BitBang800KbpsMethod> rgb_led(1, RGB_LED_PIN);
|
||||||
|
#endif
|
||||||
|
|
||||||
// define whole brigtness level for RGBLED
|
|
||||||
uint8_t rgb_brightness = 127;
|
// define whole brigtness level for RGBLED (50%)
|
||||||
|
uint8_t rgb_brightness = 50;
|
||||||
// LED Blink timers
|
// LED Blink timers
|
||||||
Ticker rgb_ticker;
|
Ticker rgb_ticker;
|
||||||
Ticker blu_ticker;
|
Ticker blu_ticker;
|
||||||
@@ -143,6 +147,51 @@ void LedOff(int led)
|
|||||||
LedRGBOFF();
|
LedRGBOFF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Light off the RGB LED
|
||||||
|
#ifdef RGB_LED_PIN
|
||||||
|
/* ======================================================================
|
||||||
|
Function: LedRGBON
|
||||||
|
Purpose : Light RGB Led with HSB value
|
||||||
|
Input : Hue (0..255)
|
||||||
|
Saturation (0..255)
|
||||||
|
Brightness (0..255)
|
||||||
|
Output : -
|
||||||
|
Comments:
|
||||||
|
====================================================================== */
|
||||||
|
void LedRGBON (uint16_t hue)
|
||||||
|
{
|
||||||
|
if (config.config & CFG_RGB_LED) {
|
||||||
|
// Convert to neoPixel API values
|
||||||
|
// H (is color from 0..360) should be between 0.0 and 1.0
|
||||||
|
// L (is brightness from 0..100) should be between 0.0 and 0.5
|
||||||
|
RgbColor target = HslColor( hue / 360.0f, 1.0f, rgb_brightness * 0.005f );
|
||||||
|
|
||||||
|
// Set RGB Led
|
||||||
|
rgb_led.SetPixelColor(0, target);
|
||||||
|
rgb_led.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ======================================================================
|
||||||
|
Function: LedRGBOFF
|
||||||
|
Purpose : light off the RGN LED
|
||||||
|
Input : -
|
||||||
|
Output : -
|
||||||
|
Comments: -
|
||||||
|
====================================================================== */
|
||||||
|
//void LedOff(int led)
|
||||||
|
void LedRGBOFF(void)
|
||||||
|
{
|
||||||
|
if (config.config & CFG_RGB_LED) {
|
||||||
|
rgb_led.SetPixelColor(0,RgbColor(0));
|
||||||
|
rgb_led.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================================
|
/* ======================================================================
|
||||||
Function: ADPSCallback
|
Function: ADPSCallback
|
||||||
Purpose : called by library when we detected a ADPS on any phased
|
Purpose : called by library when we detected a ADPS on any phased
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ boolean httpPost(char * host, uint16_t port, char * url)
|
|||||||
unsigned long start = millis();
|
unsigned long start = millis();
|
||||||
|
|
||||||
// configure traged server and url
|
// configure traged server and url
|
||||||
http.begin(host, port, url, port==443 ? true : false);
|
http.begin(host, port, url);
|
||||||
//http.begin("http://emoncms.org/input/post.json?node=20&apikey=2f13e4608d411d20354485f72747de7b&json={PAPP:100}");
|
//http.begin("http://emoncms.org/input/post.json?node=20&apikey=2f13e4608d411d20354485f72747de7b&json={PAPP:100}");
|
||||||
//http.begin("emoncms.org", 80, "/input/post.json?node=20&apikey=2f13e4608d411d20354485f72747de7b&json={}"); //HTTP
|
//http.begin("emoncms.org", 80, "/input/post.json?node=20&apikey=2f13e4608d411d20354485f72747de7b&json={}"); //HTTP
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hallard/LibTeleinfo.git"
|
"url": "https://github.com/hallard/LibTeleinfo.git"
|
||||||
},
|
},
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"authors":
|
"authors":
|
||||||
{
|
{
|
||||||
"name": "Charles-Henri Hallard",
|
"name": "Charles-Henri Hallard",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name=LibTeleinfo
|
name=LibTeleinfo
|
||||||
version=1.0.1
|
version=1.0.2
|
||||||
author=Charles-Henri Hallard <hallard.me>
|
author=Charles-Henri Hallard <hallard.me>
|
||||||
maintainer=Charles-Henri Hallard <community.hallard.me>
|
maintainer=Charles-Henri Hallard <community.hallard.me>
|
||||||
sentence=Teleinfo French power meter reader and decoding
|
sentence=Teleinfo French power meter reader and decoding
|
||||||
|
|||||||
@@ -249,10 +249,10 @@ ValueList * TInfo::valueAdd(char * name, char * value, uint8_t checksum, uint8_t
|
|||||||
// + Value + '\0'
|
// + Value + '\0'
|
||||||
size_t size ;
|
size_t size ;
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
lgname = xPortWantedSizeAlign(lgname+1); // Align name buffer
|
lgname = ESP8266_allocAlign(lgname+1); // Align name buffer
|
||||||
lgvalue = xPortWantedSizeAlign(lgvalue+1); // Align value buffer
|
lgvalue = ESP8266_allocAlign(lgvalue+1); // Align value buffer
|
||||||
// Align the whole structure
|
// Align the whole structure
|
||||||
size = xPortWantedSizeAlign( sizeof(ValueList) + lgname + lgvalue ) ;
|
size = ESP8266_allocAlign( sizeof(ValueList) + lgname + lgvalue ) ;
|
||||||
#else
|
#else
|
||||||
size = sizeof(ValueList) + lgname + 1 + lgvalue + 1 ;
|
size = sizeof(ValueList) + lgname + 1 + lgvalue + 1 ;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,10 +38,10 @@
|
|||||||
|
|
||||||
// Using ESP8266 ?
|
// Using ESP8266 ?
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
//#include "stdlib_noniso.h"
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Define this if you want library to be verbose
|
// Define this if you want library to be verbose
|
||||||
//#define TI_DEBUG
|
//#define TI_DEBUG
|
||||||
|
|
||||||
@@ -67,6 +67,12 @@
|
|||||||
#define TI_Debugflush
|
#define TI_Debugflush
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
|
// For 4 bytes Aligment boundaries
|
||||||
|
#define ESP8266_allocAlign(size) ((size + 3) & ~((size_t) 3))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#pragma pack(push) // push current alignment to stack
|
#pragma pack(push) // push current alignment to stack
|
||||||
#pragma pack(1) // set alignment to 1 byte boundary
|
#pragma pack(1) // set alignment to 1 byte boundary
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user