mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
Compiled for all platforms + binaries
This commit is contained in:
@@ -6,3 +6,4 @@
|
|||||||
-DSPILED_DISABLE
|
-DSPILED_DISABLE
|
||||||
-DAC_DISABLE
|
-DAC_DISABLE
|
||||||
#-DM5STACK
|
#-DM5STACK
|
||||||
|
-DOTA
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
-DMODBUS_DISABLE
|
-DMODBUS_DISABLE
|
||||||
#-DCOUNTER_DISABLE
|
#-DCOUNTER_DISABLE
|
||||||
#-DOTA
|
-DOTA
|
||||||
|
-std=gnu++11
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
../tools/mac/tool-avrdude/avrdude -C ../tools/mac/tool-avrdude/avrdude.conf -c arduino -P /dev/cu.usbmodem1411 -b 19200 -p m16u2 -vvv -U flash:w:16u2.hex:i
|
../tools/mac/tool-avrdude/avrdude -C ../tools/mac/tool-avrdude/avrdude.conf -c arduino -P /dev/cu.usbmodem14101 -b 19200 -p m16u2 -vvv -U flash:w:16u2.hex:i
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -38,5 +38,5 @@ int abstractCh::publishTopic(const char* topic, const char * value, const char*
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ int abstractIn::publish(float value, const char* subtopic)
|
|||||||
|
|
||||||
int abstractIn::publish(char * value, const char* subtopic)
|
int abstractIn::publish(char * value, const char* subtopic)
|
||||||
{
|
{
|
||||||
char addrstr[MQTT_TOPIC_LENGTH];
|
|
||||||
if (in)
|
if (in)
|
||||||
{
|
{
|
||||||
aJsonObject *emit = aJson.getObjectItem(in->inputObj, "emit");
|
aJsonObject *emit = aJson.getObjectItem(in->inputObj, "emit");
|
||||||
|
|||||||
23
lighthub/bright.cpp
Normal file
23
lighthub/bright.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include "bright.h"
|
||||||
|
|
||||||
|
uint8_t getBright(uint8_t percent)
|
||||||
|
{
|
||||||
|
int index = map(percent,0,100,0,255);
|
||||||
|
if (index>255) index=255;
|
||||||
|
return getBright255(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t getBright255(uint8_t percent)
|
||||||
|
{
|
||||||
|
#ifdef BRIGHT_LINEAR
|
||||||
|
return percent;
|
||||||
|
#else
|
||||||
|
int val = stepvar[index];
|
||||||
|
if (val>255) val=255;
|
||||||
|
Serial.print(F("Bright:"));
|
||||||
|
Serial.print(percent);
|
||||||
|
Serial.print(F("->"));
|
||||||
|
Serial.println(val);
|
||||||
|
return val;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
105
lighthub/bright.h
Normal file
105
lighthub/bright.h
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Arduino.h>
|
||||||
|
#define BRIGHT_LINEAR
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef BRIGHT_LOG
|
||||||
|
const uint8_t stepvar[] PROGMEM =
|
||||||
|
{
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
// 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||||
|
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||||
|
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||||
|
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||||
|
0x02, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x03, 0x03, 0x03, 0x04, 0x04,
|
||||||
|
0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
|
||||||
|
0x04, 0x04, 0x04, 0x04, 0x05, 0x05,
|
||||||
|
0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
|
||||||
|
0x05, 0x06, 0x06, 0x06, 0x06, 0x06,
|
||||||
|
0x06, 0x06, 0x06, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x08, 0x08, 0x08,
|
||||||
|
0x08, 0x08, 0x08, 0x09, 0x09, 0x09,
|
||||||
|
0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A,
|
||||||
|
0x0A, 0x0B, 0x0B, 0x0B, 0x0B, 0x0C,
|
||||||
|
0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D,
|
||||||
|
0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F,
|
||||||
|
0x0F, 0x10, 0x10, 0x10, 0x11, 0x11,
|
||||||
|
0x12, 0x12, 0x12, 0x13, 0x13, 0x14,
|
||||||
|
0x14, 0x14, 0x15, 0x15, 0x16, 0x16,
|
||||||
|
0x17, 0x17, 0x18, 0x18, 0x19, 0x19,
|
||||||
|
0x1A, 0x1B, 0x1B, 0x1C, 0x1C, 0x1D,
|
||||||
|
0x1E, 0x1E, 0x1F, 0x20, 0x20, 0x21,
|
||||||
|
0x22, 0x23, 0x23, 0x24, 0x25, 0x26,
|
||||||
|
0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
|
||||||
|
0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31,
|
||||||
|
0x32, 0x33, 0x34, 0x35, 0x37, 0x38,
|
||||||
|
0x39, 0x3A, 0x3B, 0x3D, 0x3E, 0x3F,
|
||||||
|
0x41, 0x42, 0x44, 0x45, 0x47, 0x48,
|
||||||
|
0x4A, 0x4C, 0x4D, 0x4F, 0x51, 0x52,
|
||||||
|
0x54, 0x56, 0x58, 0x5A, 0x5C, 0x5E,
|
||||||
|
0x60, 0x62, 0x64, 0x66, 0x69, 0x6B,
|
||||||
|
0x6D, 0x70, 0x72, 0x75, 0x77, 0x7A,
|
||||||
|
0x7C, 0x7F, 0x82, 0x85, 0x88, 0x8B,
|
||||||
|
0x8E, 0x91, 0x94, 0x97, 0x9B, 0x9E,
|
||||||
|
0xA2, 0xA5, 0xA9, 0xAC, 0xB0, 0xB4,
|
||||||
|
0xB8, 0xBC, 0xC0, 0xC4, 0xC9, 0xCD,
|
||||||
|
0xD2, 0xD6, 0xDB, 0xE0, 0xE5, 0xEA,
|
||||||
|
0xEF, 0xF4, 0xF9, 0xFF};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef BRIGHT_STEP
|
||||||
|
const uint8_t stepvar[] PROGMEM =
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
|
||||||
|
0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||||
|
0x02, 0x02, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x03, 0x03, 0x04, 0x04, 0x04, 0x04,
|
||||||
|
0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
|
||||||
|
0x06, 0x06, 0x06, 0x06, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x08, 0x08, 0x08, 0x08,
|
||||||
|
0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A,
|
||||||
|
0x0B, 0x0B, 0x0C, 0x0C, 0x0C, 0x0D,
|
||||||
|
0x0D, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F,
|
||||||
|
0x10, 0x10, 0x11, 0x11, 0x12, 0x12,
|
||||||
|
0x13, 0x13, 0x14, 0x14, 0x15, 0x16,
|
||||||
|
0x16, 0x17, 0x17, 0x18, 0x19, 0x19,
|
||||||
|
0x1A, 0x1B, 0x1B, 0x1C, 0x1D, 0x1D,
|
||||||
|
0x1E, 0x1F, 0x20, 0x20, 0x21, 0x22,
|
||||||
|
0x23, 0x23, 0x24, 0x25, 0x26, 0x27,
|
||||||
|
0x28, 0x29, 0x29, 0x2A, 0x2B, 0x2C,
|
||||||
|
0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32,
|
||||||
|
0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
|
||||||
|
0x39, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||||
|
0x40, 0x42, 0x43, 0x44, 0x45, 0x47,
|
||||||
|
0x48, 0x49, 0x4B, 0x4C, 0x4D, 0x4F,
|
||||||
|
0x50, 0x51, 0x53, 0x54, 0x56, 0x57,
|
||||||
|
0x59, 0x5A, 0x5C, 0x5D, 0x5F, 0x60,
|
||||||
|
0x62, 0x64, 0x65, 0x67, 0x68, 0x6A,
|
||||||
|
0x6C, 0x6E, 0x6F, 0x71, 0x73, 0x75,
|
||||||
|
0x76, 0x78, 0x7A, 0x7C, 0x7E, 0x80,
|
||||||
|
0x82, 0x84, 0x85, 0x87, 0x89, 0x8B,
|
||||||
|
0x8E, 0x90, 0x92, 0x94, 0x96, 0x98,
|
||||||
|
0x9A, 0x9C, 0x9E, 0xA1, 0xA3, 0xA5,
|
||||||
|
0xA7, 0xAA, 0xAC, 0xAE, 0xB1, 0xB3,
|
||||||
|
0xB6, 0xB8, 0xBA, 0xBD, 0xBF, 0xC2,
|
||||||
|
0xC4, 0xC7, 0xCA, 0xCC, 0xCF, 0xD1,
|
||||||
|
0xD4, 0xD7, 0xD9, 0xDC, 0xDF, 0xE2,
|
||||||
|
0xE5, 0xE7, 0xEA, 0xED, 0xF0, 0xF3,
|
||||||
|
0xF6, 0xF9, 0xFC, 0xFF};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t getBright(uint8_t percent);
|
||||||
|
uint8_t getBright255(uint8_t percent);
|
||||||
@@ -122,7 +122,6 @@ void DMXSemiImmediateUpdate(short tch,short trh, int val)
|
|||||||
|
|
||||||
void DMXput(void)
|
void DMXput(void)
|
||||||
{
|
{
|
||||||
int t;
|
|
||||||
for (short tch=0; tch<=3 ; tch++)
|
for (short tch=0; tch<=3 ; tch++)
|
||||||
{
|
{
|
||||||
short base = tch*4;
|
short base = tch*4;
|
||||||
@@ -202,7 +201,7 @@ for (int i=1; i<17; i++) {Serial.print(dmxin.read(i));Serial.print(";");}
|
|||||||
void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data, IPAddress remoteIP)
|
void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data, IPAddress remoteIP)
|
||||||
{
|
{
|
||||||
#ifdef _dmxout
|
#ifdef _dmxout
|
||||||
for (int i = 0 ; i < length && i<MAX_CHANNELS ; i++)
|
for (unsigned int i = 0 ; i < length && i<MAX_CHANNELS ; i++)
|
||||||
{
|
{
|
||||||
DmxWrite(i+1,data[i]);
|
DmxWrite(i+1,data[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ switch (inType)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Input::poll(short cause) {
|
int Input::Poll(short cause) {
|
||||||
|
|
||||||
if (!isValid()) return -1;
|
if (!isValid()) return -1;
|
||||||
#ifndef CSSHDC_DISABLE
|
#ifndef CSSHDC_DISABLE
|
||||||
@@ -533,6 +533,7 @@ return true;
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
} //switch type
|
} //switch type
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Polling via timed interrupt with CHECK_INTERRUPT cause
|
// TODO Polling via timed interrupt with CHECK_INTERRUPT cause
|
||||||
@@ -669,8 +670,10 @@ switch (store->state) //Timer based transitions
|
|||||||
{
|
{
|
||||||
case IS_PRESSED:
|
case IS_PRESSED:
|
||||||
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_LONG,0xFFFF))
|
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_LONG,0xFFFF))
|
||||||
|
{
|
||||||
if (!aJson.getObjectItem(inputObj, "lcmd") && !aJson.getObjectItem(inputObj, "rpcmd")) changeState(IS_WAITRELEASE, cause);
|
if (!aJson.getObjectItem(inputObj, "lcmd") && !aJson.getObjectItem(inputObj, "rpcmd")) changeState(IS_WAITRELEASE, cause);
|
||||||
else changeState(IS_LONG, cause);
|
else changeState(IS_LONG, cause);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IS_LONG:
|
case IS_LONG:
|
||||||
@@ -691,8 +694,10 @@ switch (store->state) //Timer based transitions
|
|||||||
|
|
||||||
case IS_PRESSED2:
|
case IS_PRESSED2:
|
||||||
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_LONG,0xFFFF))
|
if (isTimeOver(store->timestamp16,millis() & 0xFFFF,T_LONG,0xFFFF))
|
||||||
|
{
|
||||||
if (!aJson.getObjectItem(inputObj, "lcmd2") && !aJson.getObjectItem(inputObj, "rpcmd2")) changeState(IS_WAITRELEASE, cause);
|
if (!aJson.getObjectItem(inputObj, "lcmd2") && !aJson.getObjectItem(inputObj, "rpcmd2")) changeState(IS_WAITRELEASE, cause);
|
||||||
else changeState(IS_LONG2, cause);
|
else changeState(IS_LONG2, cause);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IS_LONG2:
|
case IS_LONG2:
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public:
|
|||||||
void onContactChanged(int newValue);
|
void onContactChanged(int newValue);
|
||||||
void onAnalogChanged(float newValue);
|
void onAnalogChanged(float newValue);
|
||||||
|
|
||||||
int poll(short cause);
|
int Poll(short cause);
|
||||||
void setup();
|
void setup();
|
||||||
|
|
||||||
static void inline onCounterChanged(int i);
|
static void inline onCounterChanged(int i);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ e-mail anklimov@gmail.com
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "textconst.h"
|
#include "textconst.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "bright.h"
|
||||||
|
|
||||||
#ifdef _dmxout
|
#ifdef _dmxout
|
||||||
#include "dmx.h"
|
#include "dmx.h"
|
||||||
@@ -50,9 +51,6 @@ extern int8_t ethernetIdleCount;
|
|||||||
extern int8_t configLocked;
|
extern int8_t configLocked;
|
||||||
extern lan_status lanStatus;
|
extern lan_status lanStatus;
|
||||||
|
|
||||||
static unsigned long lastctrl = 0;
|
|
||||||
static aJsonObject *lastobj = NULL;
|
|
||||||
|
|
||||||
int retrieveCode(char **psubItem);
|
int retrieveCode(char **psubItem);
|
||||||
|
|
||||||
int txt2cmd(char *payload) {
|
int txt2cmd(char *payload) {
|
||||||
@@ -94,6 +92,7 @@ int subitem2cmd(char *payload) {
|
|||||||
|
|
||||||
// Check for command
|
// Check for command
|
||||||
if (payload)
|
if (payload)
|
||||||
|
{
|
||||||
if (strcmp_P(payload, ON_P) == 0) cmd = CMD_ON;
|
if (strcmp_P(payload, ON_P) == 0) cmd = CMD_ON;
|
||||||
else if (strcmp_P(payload, OFF_P) == 0) cmd = CMD_OFF;
|
else if (strcmp_P(payload, OFF_P) == 0) cmd = CMD_OFF;
|
||||||
//else if (strcmp_P(payload, REST_P) == 0) cmd = CMD_RESTORE;
|
//else if (strcmp_P(payload, REST_P) == 0) cmd = CMD_RESTORE;
|
||||||
@@ -109,7 +108,7 @@ int subitem2cmd(char *payload) {
|
|||||||
//else if (strcmp_P(payload, HIGH_P) == 0) cmd = CMD_HIGH;
|
//else if (strcmp_P(payload, HIGH_P) == 0) cmd = CMD_HIGH;
|
||||||
//else if (strcmp_P(payload, MED_P) == 0) cmd = CMD_MED;
|
//else if (strcmp_P(payload, MED_P) == 0) cmd = CMD_MED;
|
||||||
//else if (strcmp_P(payload, LOW_P) == 0) cmd = CMD_LOW;
|
//else if (strcmp_P(payload, LOW_P) == 0) cmd = CMD_LOW;
|
||||||
|
}
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,6 +255,7 @@ short Item::getFlag (short flag)
|
|||||||
{
|
{
|
||||||
return itemCmd->valueint & flag & FLAG_MASK;
|
return itemCmd->valueint & flag & FLAG_MASK;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::setFlag (short flag)
|
void Item::setFlag (short flag)
|
||||||
@@ -493,7 +493,7 @@ debugSerial<<F("Txt2Cmd:")<<cmd<<endl;
|
|||||||
return Ctrl(cmd, 0, NULL, send, suffixCode, subItem);
|
return Ctrl(cmd, 0, NULL, send, suffixCode, subItem);
|
||||||
|
|
||||||
} //ctrl
|
} //ctrl
|
||||||
//}
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -612,7 +612,7 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
|||||||
case CMD_DN:
|
case CMD_DN:
|
||||||
case CMD_UP:
|
case CMD_UP:
|
||||||
{
|
{
|
||||||
if (itemType == CH_GROUP) break;
|
if (itemType == CH_GROUP) break; ////bug here
|
||||||
if (!n || !Par[0]) Par[0] = DEFAULT_INC_STEP;
|
if (!n || !Par[0]) Par[0] = DEFAULT_INC_STEP;
|
||||||
if (cmd == CMD_DN) Par[0]=-Par[0];
|
if (cmd == CMD_DN) Par[0]=-Par[0];
|
||||||
st.aslong = getVal();
|
st.aslong = getVal();
|
||||||
@@ -1001,13 +1001,19 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
|||||||
|
|
||||||
|
|
||||||
int rgbSaturation =map(Par[1], 0, 100, 0, 255);
|
int rgbSaturation =map(Par[1], 0, 100, 0, 255);
|
||||||
int rgbValue = map(Par[2], 0, 100, 0, 255);
|
// int rgbValue = map(Par[2], 0, 100, 0, 255);
|
||||||
|
//Vebler-Heffler law
|
||||||
|
// float x = Par[2]/25.-3.;
|
||||||
|
// int rgbValue = round(exp(x)/(exp(1)/255));
|
||||||
|
int rgbValue = getBright(Par[1]);
|
||||||
|
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
|
|
||||||
#ifdef _dmxout
|
#ifdef _dmxout
|
||||||
case CH_DIMMER: //Dimmed light
|
case CH_DIMMER: //Dimmed light
|
||||||
if (iaddr>0)
|
if (iaddr>0)
|
||||||
DmxWrite(iaddr, map(Par[0], 0, 100, 0, 255));
|
// DmxWrite(iaddr, map(Par[0], 0, 100, 0, 255));
|
||||||
|
DmxWrite(iaddr, getBright(Par[0]));
|
||||||
break;
|
break;
|
||||||
case CH_RGBW: //Colour RGBW
|
case CH_RGBW: //Colour RGBW
|
||||||
// Saturation 0 - Only white
|
// Saturation 0 - Only white
|
||||||
@@ -1016,9 +1022,9 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
|||||||
{
|
{
|
||||||
// int k;
|
// int k;
|
||||||
if (Par[1]<50 && iaddr>0) { // Using white
|
if (Par[1]<50 && iaddr>0) { // Using white
|
||||||
DmxWrite(iaddr + 3, map((50 - Par[1]) * Par[2], 0, 5000, 0, 255));
|
DmxWrite(iaddr + 3, getBright255(map((50 - Par[1]) * Par[2], 0, 5000, 0, 255)));
|
||||||
int rgbvLevel = map (Par[1],0,50,0,255*2);
|
int rgbvLevel = map (Par[1],0,50,0,255*2);
|
||||||
rgbValue = map(Par[2], 0, 100, 0, rgbvLevel);
|
rgbValue = map(getBright(Par[2]), 0, 255, 0, rgbvLevel);
|
||||||
rgbSaturation = map(Par[1], 0, 50, 255, 100);
|
rgbSaturation = map(Par[1], 0, 50, 255, 100);
|
||||||
if (rgbValue>255) rgbValue = 255;
|
if (rgbValue>255) rgbValue = 255;
|
||||||
}
|
}
|
||||||
@@ -1054,7 +1060,8 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
|||||||
DmxWrite(iaddr, 0);
|
DmxWrite(iaddr, 0);
|
||||||
DmxWrite(iaddr + 1, 0);
|
DmxWrite(iaddr + 1, 0);
|
||||||
DmxWrite(iaddr + 2, 0);
|
DmxWrite(iaddr + 2, 0);
|
||||||
DmxWrite(iaddr + 3, map(Par[2], 0, 100, 0, 255));
|
// DmxWrite(iaddr + 3, map(Par[2], 0, 100, 0, 255));
|
||||||
|
DmxWrite(iaddr + 3,rgbValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1154,6 +1161,7 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Item::isActive() {
|
int Item::isActive() {
|
||||||
@@ -1706,13 +1714,16 @@ int Item::checkModbusDimmer(int data) {
|
|||||||
} //if data changed
|
} //if data changed
|
||||||
}
|
}
|
||||||
|
|
||||||
int Item::Poll(short cause) {
|
#endif
|
||||||
|
|
||||||
|
int Item::Poll(int cause) {
|
||||||
|
|
||||||
switch (cause)
|
switch (cause)
|
||||||
{
|
{
|
||||||
case POLLING_SLOW:
|
case POLLING_SLOW:
|
||||||
// Legacy polling
|
// Legacy polling
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
|
#ifndef MODBUS_DISABLE
|
||||||
case CH_MODBUS:
|
case CH_MODBUS:
|
||||||
checkModbusDimmer();
|
checkModbusDimmer();
|
||||||
sendDelayedStatus();
|
sendDelayedStatus();
|
||||||
@@ -1728,6 +1739,7 @@ switch (cause)
|
|||||||
sendDelayedStatus();
|
sendDelayedStatus();
|
||||||
return INTERVAL_CHECK_MODBUS;
|
return INTERVAL_CHECK_MODBUS;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
/* case CH_RGB: //All channels with slider generate too many updates
|
/* case CH_RGB: //All channels with slider generate too many updates
|
||||||
case CH_RGBW:
|
case CH_RGBW:
|
||||||
case CH_DIMMER:
|
case CH_DIMMER:
|
||||||
@@ -1758,7 +1770,7 @@ void Item::sendDelayedStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
int Item::SendStatus(int sendFlags) {
|
int Item::SendStatus(int sendFlags) {
|
||||||
int chancmd=getCmd();
|
int chancmd=getCmd();
|
||||||
if ((sendFlags & SEND_DEFFERED) || (lanStatus==RETAINING_COLLECTING)) {
|
if ((sendFlags & SEND_DEFFERED) || (lanStatus==RETAINING_COLLECTING)) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright © 2017-2018 Andrey Klimov. All rights reserved.
|
/* Copyright © 2017-2020 Andrey Klimov. All rights reserved.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -36,15 +36,7 @@ e-mail anklimov@gmail.com
|
|||||||
#define S_HUE 7
|
#define S_HUE 7
|
||||||
#define S_SAT 8
|
#define S_SAT 8
|
||||||
#define S_ADDITIONAL 64
|
#define S_ADDITIONAL 64
|
||||||
/*
|
|
||||||
|
|
||||||
#define S_RPM 11
|
|
||||||
#define S_TEMP 3
|
|
||||||
#define S_SETPOINT 5
|
|
||||||
#define S_POWER 6
|
|
||||||
#define S_VOL 7
|
|
||||||
#define S_HEAT 8
|
|
||||||
*/
|
|
||||||
#define CH_DIMMER 0 //DMX 1 ch
|
#define CH_DIMMER 0 //DMX 1 ch
|
||||||
#define CH_RGBW 1 //DMX 4 ch
|
#define CH_RGBW 1 //DMX 4 ch
|
||||||
#define CH_RGB 2 //DMX 3 ch
|
#define CH_RGB 2 //DMX 3 ch
|
||||||
@@ -99,6 +91,7 @@ e-mail anklimov@gmail.com
|
|||||||
#define SEND_RETRY 0x400
|
#define SEND_RETRY 0x400
|
||||||
#define SEND_DEFFERED 0x800
|
#define SEND_DEFFERED 0x800
|
||||||
#define ACTION_NEEDED 0x1000
|
#define ACTION_NEEDED 0x1000
|
||||||
|
#define ACTION_IN_PROCESS 0x2000
|
||||||
|
|
||||||
//#define CMD_REPORT 32
|
//#define CMD_REPORT 32
|
||||||
|
|
||||||
@@ -183,16 +176,15 @@ class Item
|
|||||||
short getFlag (short flag=FLAG_MASK);
|
short getFlag (short flag=FLAG_MASK);
|
||||||
void setFlag (short flag);
|
void setFlag (short flag);
|
||||||
void clearFlag (short flag);
|
void clearFlag (short flag);
|
||||||
//void setVal(uint8_t n, int par);
|
|
||||||
void setVal(long int par);
|
void setVal(long int par);
|
||||||
//void copyPar (aJsonObject *itemV);
|
int Poll(int cause);
|
||||||
inline int On (){return Ctrl(CMD_ON);};
|
|
||||||
inline int Off(){return Ctrl(CMD_OFF);};
|
|
||||||
inline int Toggle(){return Ctrl(CMD_TOGGLE);};
|
|
||||||
int Poll(short cause);
|
|
||||||
int SendStatus(int sendFlags);
|
int SendStatus(int sendFlags);
|
||||||
int isActive();
|
int isActive();
|
||||||
int getChanType();
|
int getChanType();
|
||||||
|
inline int On (){return Ctrl(CMD_ON);};
|
||||||
|
inline int Off(){return Ctrl(CMD_OFF);};
|
||||||
|
inline int Toggle(){return Ctrl(CMD_TOGGLE);};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//short cmd2changeActivity(int lastActivity, short defaultCmd = CMD_SET);
|
//short cmd2changeActivity(int lastActivity, short defaultCmd = CMD_SET);
|
||||||
int VacomSetFan (int8_t val, int8_t cmd=0);
|
int VacomSetFan (int8_t val, int8_t cmd=0);
|
||||||
|
|||||||
@@ -1817,7 +1817,7 @@ configLocked++;
|
|||||||
while (input) {
|
while (input) {
|
||||||
if ((input->type == aJson_Object)) {
|
if ((input->type == aJson_Object)) {
|
||||||
Input in(input);
|
Input in(input);
|
||||||
in.poll(CHECK_INPUT);
|
in.Poll(CHECK_INPUT);
|
||||||
}
|
}
|
||||||
input = input->next;
|
input = input->next;
|
||||||
}
|
}
|
||||||
@@ -1829,7 +1829,7 @@ configLocked++;
|
|||||||
while (input) {
|
while (input) {
|
||||||
if ((input->type == aJson_Object)) {
|
if ((input->type == aJson_Object)) {
|
||||||
Input in(input);
|
Input in(input);
|
||||||
in.poll(CHECK_SENSOR);
|
in.Poll(CHECK_SENSOR);
|
||||||
}
|
}
|
||||||
input = input->next;
|
input = input->next;
|
||||||
}
|
}
|
||||||
@@ -1862,7 +1862,7 @@ if (items) {
|
|||||||
if (item->type == aJson_Array && aJson.getArraySize(item)>1) {
|
if (item->type == aJson_Array && aJson.getArraySize(item)>1) {
|
||||||
Item it(item);
|
Item it(item);
|
||||||
if (it.isValid()) {
|
if (it.isValid()) {
|
||||||
it.Poll(POLLING_FAST);
|
it.Poll(POLLING_FAST);
|
||||||
} //isValid
|
} //isValid
|
||||||
item = item->next;
|
item = item->next;
|
||||||
} //if
|
} //if
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
#include <FS.h> //this needs to be first, or it all crashes and burns...
|
#include <FS.h> //this needs to be first, or it all crashes and burns...
|
||||||
|
//#include "SPIFFS.h"
|
||||||
#include <ESP_EEPROM.h>
|
#include <ESP_EEPROM.h>
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
//#include <ArduinoHttpClient.h>
|
//#include <ArduinoHttpClient.h>
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
|
|
||||||
#if defined ARDUINO_ARCH_ESP32
|
#if defined ARDUINO_ARCH_ESP32
|
||||||
#include <FS.h> //this needs to be first, or it all crashes and burns...
|
#include <FS.h> //this needs to be first, or it all crashes and burns...
|
||||||
|
//#include "SPIFFS.h"
|
||||||
//#include <EEPROM.h>
|
//#include <EEPROM.h>
|
||||||
#include <NRFFlashStorage.h>
|
#include <NRFFlashStorage.h>
|
||||||
//#include "HttpClient.h"
|
//#include "HttpClient.h"
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ lib_ignore =
|
|||||||
SparkFun CCS811 Arduino Library
|
SparkFun CCS811 Arduino Library
|
||||||
ESP8266HTTPClient
|
ESP8266HTTPClient
|
||||||
M5Stack
|
M5Stack
|
||||||
ArduinoOTA
|
;ArduinoOTA
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
@@ -103,8 +103,8 @@ lib_deps =
|
|||||||
DHT sensor library
|
DHT sensor library
|
||||||
Streaming
|
Streaming
|
||||||
https://github.com/anklimov/NRFFlashStorage
|
https://github.com/anklimov/NRFFlashStorage
|
||||||
Adafruit NeoPixel
|
https://github.com/adafruit/Adafruit_NeoPixel.git
|
||||||
; https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
; https://github.com/livello/PrintEx#is-select-redecl
|
; https://github.com/livello/PrintEx#is-select-redecl
|
||||||
|
|
||||||
|
|
||||||
@@ -152,10 +152,10 @@ lib_deps =
|
|||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
;SparkFun CCS811 Arduino Library
|
;SparkFun CCS811 Arduino Library
|
||||||
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
M5Stack
|
M5Stack
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
[env:esp32-wifi]
|
[env:esp32-wifi]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
@@ -202,9 +202,9 @@ lib_deps =
|
|||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
;SparkFun CCS811 Arduino Library
|
;SparkFun CCS811 Arduino Library
|
||||||
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
[env:due-5100]
|
[env:due-5100]
|
||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
@@ -226,7 +226,7 @@ lib_ignore =
|
|||||||
UIPEthernet
|
UIPEthernet
|
||||||
EEPROM
|
EEPROM
|
||||||
M5Stack
|
M5Stack
|
||||||
ArduinoOTA
|
;ArduinoOTA
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/sebnil/DueFlashStorage
|
https://github.com/sebnil/DueFlashStorage
|
||||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
@@ -249,7 +249,7 @@ lib_deps =
|
|||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
;https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
[env:mega2560slim-5100]
|
[env:mega2560slim-5100]
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
@@ -290,7 +290,7 @@ lib_deps =
|
|||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
[env:mega2560-5500]
|
[env:mega2560-5500]
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
@@ -330,18 +330,20 @@ lib_deps =
|
|||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
|
|
||||||
[env:esp8266-wifi]
|
[env:esp8266-wifi]
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = nodemcuv2
|
board = nodemcuv2
|
||||||
upload_protocol = espota
|
upload_protocol = esptool
|
||||||
upload_port = Lighthub.local
|
|
||||||
;192.168.88.46
|
;upload_protocol = espota
|
||||||
upload_flags =
|
;upload_port = Lighthub.local
|
||||||
--auth=password
|
|
||||||
|
;upload_flags =
|
||||||
|
; --auth=password
|
||||||
; --port=65280
|
; --port=65280
|
||||||
build_flags = !python get_build_flags.py esp8266-wifi
|
build_flags = !python get_build_flags.py esp8266-wifi
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
@@ -384,7 +386,8 @@ lib_deps =
|
|||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA.git
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[env:mega2560-5100]
|
[env:mega2560-5100]
|
||||||
@@ -427,7 +430,7 @@ lib_deps =
|
|||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
[env:due-5500]
|
[env:due-5500]
|
||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
@@ -451,7 +454,7 @@ lib_ignore =
|
|||||||
ESP_EEPROM
|
ESP_EEPROM
|
||||||
EEPROM
|
EEPROM
|
||||||
M5Stack
|
M5Stack
|
||||||
ArduinoOTA
|
;ArduinoOTA
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/sebnil/DueFlashStorage
|
https://github.com/sebnil/DueFlashStorage
|
||||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
@@ -475,7 +478,7 @@ lib_deps =
|
|||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
[env:lighthub21]
|
[env:lighthub21]
|
||||||
platform = atmelsam
|
platform = atmelsam
|
||||||
@@ -498,7 +501,7 @@ lib_ignore =
|
|||||||
ESP_EEPROM
|
ESP_EEPROM
|
||||||
EEPROM
|
EEPROM
|
||||||
M5Stack
|
M5Stack
|
||||||
ArduinoOTA
|
;ArduinoOTA
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/sebnil/DueFlashStorage
|
https://github.com/sebnil/DueFlashStorage
|
||||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
@@ -522,7 +525,7 @@ lib_deps =
|
|||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
|
|
||||||
[env:controllino]
|
[env:controllino]
|
||||||
@@ -565,7 +568,7 @@ lib_deps =
|
|||||||
ClosedCube HDC1080
|
ClosedCube HDC1080
|
||||||
SparkFun CCS811 Arduino Library@~1.0.7
|
SparkFun CCS811 Arduino Library@~1.0.7
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
https://github.com/jandrassy/ArduinoOTA
|
https://github.com/anklimov/ArduinoOTA
|
||||||
|
|
||||||
[env:stm32-enc2860]
|
[env:stm32-enc2860]
|
||||||
platform = ststm32
|
platform = ststm32
|
||||||
|
|||||||
Reference in New Issue
Block a user