mirror of
https://github.com/anklimov/lighthub
synced 2025-12-10 05:39:51 +03:00
DMX Modbus OneWire support now can be disabled
This commit is contained in:
@@ -125,6 +125,9 @@ platformio device monitor -b 115200
|
||||
* Wiz5500 //Use Wiznet 5500 library instead Wiznet 5100
|
||||
* DISABLE_FREERAM_PRINT // disable printing free Ram in bytes
|
||||
* CUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:00 //set firmware macaddress
|
||||
* DMX_DISABLE //disable DMX support
|
||||
* MODBUS_DISABLE // disable Modbus support
|
||||
* OWIRE_DISABLE // disable OneWire support
|
||||
|
||||
Look at build_flags_template.sh for customizing.
|
||||
|
||||
@@ -137,3 +140,6 @@ Look at build_flags_template.sh for customizing.
|
||||
* Wiznet 5100 (for MEGA & DUE)
|
||||
* Free Ram printing enabled
|
||||
* de:ad:be:ef:fe:00
|
||||
* DMX support enabled
|
||||
* Modbus support enabled
|
||||
* OneWire support enabled
|
||||
|
||||
@@ -14,5 +14,8 @@
|
||||
export FLAGS="$FLAGS -DWiz5500"
|
||||
export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
|
||||
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:00"
|
||||
export FLAGS="$FLAGS -DDMX_DISABLE"
|
||||
export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
||||
export FLAGS="$FLAGS -DOWIRE_DISABLE"
|
||||
export PLATFORMIO_BUILD_FLAGS="$FLAGS"
|
||||
unset FLAGS
|
||||
@@ -122,9 +122,10 @@ DueFlashStorage EEPROM;
|
||||
#define wdt_en()
|
||||
#define wdt_dis()
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#include "Dhcp.h"
|
||||
|
||||
#ifdef Wiz5500
|
||||
#include <Ethernet2.h>
|
||||
#else
|
||||
@@ -447,31 +448,24 @@ if((wifiMulti.run() == WL_CONNECTED)) lanStatus=1;
|
||||
wdt_dis();
|
||||
if (lanStatus > 0)
|
||||
switch (Ethernet.maintain()) {
|
||||
case 1:
|
||||
case DHCP_CHECK_RENEW_FAIL:
|
||||
//renewed fail
|
||||
Serial.println(F("Error: renewed fail"));
|
||||
lanStatus = -10;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
//renewed success
|
||||
case DHCP_CHECK_RENEW_OK:
|
||||
Serial.println(F("Renewed success"));
|
||||
|
||||
//print your local IP address:
|
||||
printIPAddress();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
//rebind fail
|
||||
case DHCP_CHECK_REBIND_FAIL:
|
||||
Serial.println(F("Error: rebind fail"));
|
||||
lanStatus = -10;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
//rebind success
|
||||
case DHCP_CHECK_REBIND_OK:
|
||||
Serial.println(F("Rebind success"));
|
||||
|
||||
//print your local IP address:
|
||||
printIPAddress();
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
// Configuration of drivers enabled
|
||||
#ifndef DMX_DISABLE
|
||||
#define _dmxin
|
||||
#define _dmxout
|
||||
#endif
|
||||
|
||||
#ifndef OWIRE_DISABLE
|
||||
#define _owire
|
||||
#endif
|
||||
|
||||
#ifndef MODBUS_DISABLE
|
||||
#define _modbus
|
||||
#endif
|
||||
|
||||
#define _artnet
|
||||
|
||||
#if defined(ESP8266)
|
||||
|
||||
@@ -19,6 +19,7 @@ e-mail anklimov@gmail.com
|
||||
*/
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@@ -29,51 +30,50 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
void PrintBytes(uint8_t* addr, uint8_t count, bool newline) {
|
||||
void PrintBytes(uint8_t *addr, uint8_t count, bool newline) {
|
||||
for (uint8_t i = 0; i < count; i++) {
|
||||
Serial.print(addr[i]>>4, HEX);
|
||||
Serial.print(addr[i]&0x0f, HEX);
|
||||
Serial.print(addr[i] >> 4, HEX);
|
||||
Serial.print(addr[i] & 0x0f, HEX);
|
||||
}
|
||||
if (newline)
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
const char HEXSTR[]="0123456789ABCDEF";
|
||||
const char HEXSTR[] = "0123456789ABCDEF";
|
||||
|
||||
void SetBytes(uint8_t* addr, uint8_t count, char * out) {
|
||||
void SetBytes(uint8_t *addr, uint8_t count, char *out) {
|
||||
// Serial.println("SB:");
|
||||
for (uint8_t i = 0; i < count; i++) {
|
||||
*(out++)=HEXSTR[(addr[i]>>4)];
|
||||
*(out++)=HEXSTR[(addr[i]&0x0f)];
|
||||
*(out++) = HEXSTR[(addr[i] >> 4)];
|
||||
*(out++) = HEXSTR[(addr[i] & 0x0f)];
|
||||
}
|
||||
*out=0;
|
||||
*out = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
byte HEX2DEC(char i)
|
||||
{ byte v;
|
||||
if ('a' <= i && i <='f') { v=i-97+10; }
|
||||
else if ('A' <= i && i <='F') { v=i-65+10; }
|
||||
else if ('0' <= i && i <='9') { v=i-48; }
|
||||
byte HEX2DEC(char i) {
|
||||
byte v;
|
||||
if ('a' <= i && i <= 'f') { v = i - 97 + 10; }
|
||||
else if ('A' <= i && i <= 'F') { v = i - 65 + 10; }
|
||||
else if ('0' <= i && i <= '9') { v = i - 48; }
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
void SetAddr(char * out, uint8_t* addr) {
|
||||
void SetAddr(char *out, uint8_t *addr) {
|
||||
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
*addr=HEX2DEC(*out++)<<4;
|
||||
*addr++|=HEX2DEC(*out++);
|
||||
*addr = HEX2DEC(*out++) << 4;
|
||||
*addr++ |= HEX2DEC(*out++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int getInt(char ** chan)
|
||||
{
|
||||
int getInt(char **chan) {
|
||||
int ch = atoi(*chan);
|
||||
*chan=strchr(*chan,',');
|
||||
*chan = strchr(*chan, ',');
|
||||
|
||||
if (*chan) *chan+=1;
|
||||
if (*chan) *chan += 1;
|
||||
//Serial.print(F("Par:")); Serial.println(ch);
|
||||
return ch;
|
||||
|
||||
@@ -98,19 +98,19 @@ unsigned long freeRam ()
|
||||
extern char _end;
|
||||
extern "C" char *sbrk(int i);
|
||||
|
||||
unsigned long freeRam()
|
||||
{
|
||||
unsigned long freeRam() {
|
||||
char *ramstart = (char *) 0x20070000;
|
||||
char *ramend = (char *) 0x20088000;
|
||||
char *heapend = sbrk(0);
|
||||
register char * stack_ptr asm( "sp" );
|
||||
register char *stack_ptr asm( "sp" );
|
||||
struct mallinfo mi = mallinfo();
|
||||
|
||||
return stack_ptr - heapend + mi.fordblks;
|
||||
}
|
||||
#endif
|
||||
|
||||
void parseBytes(const char* str, char separator, byte* bytes, int maxBytes, int base) {
|
||||
#endif
|
||||
|
||||
void parseBytes(const char *str, char separator, byte *bytes, int maxBytes, int base) {
|
||||
for (int i = 0; i < maxBytes; i++) {
|
||||
bytes[i] = strtoul(str, NULL, base); // Convert byte
|
||||
str = strchr(str, separator); // Find next separator
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
[platformio]
|
||||
src_dir = lighthub
|
||||
env_default =
|
||||
megaatmega2560
|
||||
; due
|
||||
; megaatmega2560
|
||||
due
|
||||
; esp8266
|
||||
|
||||
[env:due]
|
||||
|
||||
Reference in New Issue
Block a user