mirror of
https://github.com/anklimov/lighthub
synced 2025-12-12 22:59:49 +03:00
Mega2560slim RAM optimization
This commit is contained in:
@@ -44,9 +44,10 @@ volatile uint16_t DMXOUT_Channels=0;
|
||||
volatile uint32_t checkTimestamp=0L;
|
||||
#endif
|
||||
|
||||
#if defined(_dmxin)
|
||||
volatile uint32_t D_State=0;
|
||||
|
||||
volatile unsigned long D_checkT=0;
|
||||
#endif
|
||||
|
||||
#ifdef _artnet
|
||||
#include <Artnet.h>
|
||||
@@ -134,7 +135,10 @@ for (short tch=0; tch<=3 ; tch++)
|
||||
};
|
||||
|
||||
extern volatile uint8_t timerHandlerBusy;
|
||||
|
||||
#if defined(_dmxin)
|
||||
volatile int DMXinDoublecheck=0;
|
||||
#endif
|
||||
|
||||
void DMXUpdate(void)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ e-mail anklimov@gmail.com
|
||||
#define D_UPDATED4 8
|
||||
#define D_CHECKT 300
|
||||
|
||||
#define MAX_CHANNELS 60
|
||||
//#define MAX_CHANNELS 60
|
||||
//define MAX_IN_CHANNELS 16
|
||||
|
||||
//#define DMX_OUT_PIN 3
|
||||
|
||||
@@ -135,9 +135,11 @@ void Item::Parse() {
|
||||
itemExt = aJson.getArrayItem(itemArr, I_EXT);
|
||||
switch (itemType)
|
||||
{
|
||||
#ifndef PWM_DISABLE
|
||||
case CH_PWM:
|
||||
driver = new out_pwm (this);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifndef DMX_DISABLE
|
||||
case CH_RGBW:
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
#include "item.h"
|
||||
#include "bright.h"
|
||||
|
||||
#ifndef HSV_DISABLE
|
||||
#ifdef ADAFRUIT_LED
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#else
|
||||
#include "FastLED.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#include "hsv2rgb.h"
|
||||
|
||||
@@ -576,7 +578,7 @@ itemCmd itemCmd::assignFrom(itemCmd from, short chanType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef HSV_DISABLE
|
||||
#ifdef ADAFRUIT_LED
|
||||
Adafruit_NeoPixel strip(0, 0, 0);
|
||||
uint32_t rgb = strip.ColorHSV(map(from.param.h, 0, 365, 0, 65535), rgbSaturation, rgbValue);
|
||||
@@ -589,6 +591,9 @@ itemCmd itemCmd::assignFrom(itemCmd from, short chanType)
|
||||
param.g=rgb.g;
|
||||
param.b=rgb.b;
|
||||
#endif
|
||||
#else
|
||||
debugSerial<<F("HSV disabled")<<endl;
|
||||
#endif
|
||||
debugSerial<<F("RGBx: ");
|
||||
debugOut();
|
||||
break;
|
||||
|
||||
@@ -107,12 +107,15 @@ aJsonObject *dmxArr = NULL;
|
||||
bool syslogInitialized = false;
|
||||
#endif
|
||||
|
||||
#ifdef WIFI_ENABLE
|
||||
volatile uint32_t WiFiAwaitingTime =0;
|
||||
#endif
|
||||
|
||||
volatile uint32_t timerPollingCheck = 0;
|
||||
volatile uint32_t timerInputCheck = 0;
|
||||
volatile uint32_t timerLanCheckTime = 0;
|
||||
volatile uint32_t timerThermostatCheck = 0;
|
||||
volatile uint32_t timerSensorCheck =0;
|
||||
volatile uint32_t WiFiAwaitingTime =0;
|
||||
volatile unsigned long timerCount=0;
|
||||
volatile int16_t timerNumber=-1;
|
||||
volatile int8_t timerHandlerBusy=0;
|
||||
@@ -334,7 +337,7 @@ uint16_t httpHandler(Client& client, String request, uint8_t method, long conten
|
||||
request+=body;
|
||||
|
||||
debugSerial<<F("Cmd: ")<<request<<endl;
|
||||
if (request=="reboot ") ArduinoOTA.sendHttpResponse(client,200);
|
||||
if (request.equalsIgnoreCase(F("reboot "))) ArduinoOTA.sendHttpResponse(client,200);
|
||||
const char* res=request.c_str();
|
||||
result = cmd_parse((char*) res);
|
||||
if (! result) return 404;
|
||||
@@ -450,11 +453,12 @@ if (element && element->type == aJson_String) return element->valuestring;
|
||||
}
|
||||
|
||||
#ifdef OTA
|
||||
const char defaultPassword[] PROGMEM = "password";
|
||||
void setupOTA(void)
|
||||
{ char passwordBuf[16];
|
||||
if (!sysConf.getOTApwd(passwordBuf, sizeof(passwordBuf)))
|
||||
{
|
||||
strcpy(passwordBuf,"password");
|
||||
strcpy_P(passwordBuf,defaultPassword);
|
||||
errorSerial<<F("DEFAULT password for OTA API. Use otapwd command to set")<<endl;
|
||||
}
|
||||
|
||||
@@ -1524,8 +1528,6 @@ int cmdFunctionSetMac(int arg_cnt, char **args) {
|
||||
}
|
||||
sysConf.setMAC(mac);
|
||||
printMACAddress();
|
||||
|
||||
//for (short i = 0; i < 6; i++) { EEPROM.write(i, mac[i]); }
|
||||
infoSerial<<F("Updated\n");
|
||||
return 200;
|
||||
}
|
||||
@@ -1572,7 +1574,7 @@ void headerHandlerProc(String header)
|
||||
{
|
||||
debugSerial<<header<<endl;
|
||||
//ETag: W/"51e-17bffcd0547"
|
||||
if (header.startsWith("ETag: "))
|
||||
if (header.startsWith(F("ETag: ")))
|
||||
{
|
||||
sysConf.setETAG(header);
|
||||
}
|
||||
@@ -1622,9 +1624,8 @@ if (!sysConf.getServer(configServer,sizeof(configServer)))
|
||||
hclient.setHeaderHandler(headerHandlerProc);
|
||||
// FILE is the return STREAM type of the HTTPClient
|
||||
configStream = hclient.getURI(URI,NULL,get_header);
|
||||
debugSerial<<F("hclient")<<endl;delay(100);
|
||||
responseStatusCode = hclient.getLastReturnCode();
|
||||
debugSerial<<F("retcode ")<<responseStatusCode<<endl;delay(100);
|
||||
debugSerial<<F("http retcode ")<<responseStatusCode<<endl;delay(100);
|
||||
//wdt_en();
|
||||
|
||||
if (configStream != NULL) {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#endif
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
//#include <DueFlashStorage.h>
|
||||
#include <watchdog.h>
|
||||
#include <ArduinoHttpClient.h>
|
||||
//#include "TimerInterrupt_Generic.h"
|
||||
@@ -18,12 +17,10 @@
|
||||
//#include <ArduinoHttpClient.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/wdt.h>
|
||||
//#include <EEPROM.h>
|
||||
#endif
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#include <FS.h> //this needs to be first, or it all crashes and burns...
|
||||
//#include "SPIFFS.h"
|
||||
#ifndef FS_STORAGE
|
||||
#include <ESP_EEPROM.h>
|
||||
#endif
|
||||
@@ -132,10 +129,6 @@ extern Streamlog errorSerial;
|
||||
#include <ModbusMaster.h>
|
||||
#endif
|
||||
|
||||
//#ifndef DMX_DISABLE
|
||||
//#include "FastLED.h"
|
||||
//#endif
|
||||
|
||||
#ifdef _owire
|
||||
#include "owTerm.h"
|
||||
#endif
|
||||
@@ -231,9 +224,7 @@ typedef union {
|
||||
} UID;
|
||||
|
||||
bool isNotRetainingStatus();
|
||||
//void watchdogSetup(void);
|
||||
|
||||
//int itemCommand(char *topic, char *payload);
|
||||
void mqttCallback(char *topic, byte *payload, unsigned int length);
|
||||
|
||||
void printMACAddress();
|
||||
@@ -256,12 +247,6 @@ int cmdFunctionLoad(int arg_cnt, char **args);
|
||||
|
||||
int loadConfigFromEEPROM();
|
||||
|
||||
//void cmdFunctionReq(int arg_cnt, char **args);
|
||||
|
||||
//int mqttConfigRequest(int arg_cnt, char **args);
|
||||
|
||||
//int mqttConfigResp(char *as);
|
||||
|
||||
int cmdFunctionSave(int arg_cnt, char **args);
|
||||
|
||||
int cmdFunctionSetMac(int arg_cnt, char **args);
|
||||
|
||||
@@ -48,7 +48,12 @@ e-mail anklimov@gmail.com
|
||||
#define recheck_interval 5
|
||||
#define check_circle 2000/t_count
|
||||
|
||||
#if defined (OW_DEVICES_LIMIT)
|
||||
#define t_max 20 //Maximum number of 1w devices
|
||||
#else
|
||||
#define t_max OW_DEVICES_LIMIT
|
||||
#endif
|
||||
|
||||
#define TEMPERATURE_PRECISION 12 //9
|
||||
|
||||
#ifndef OWIRE_DISABLE
|
||||
|
||||
Reference in New Issue
Block a user