common_defitinitons->options

custom 1w pin and direct connection without DS2482-100
instructions to README
This commit is contained in:
livello
2018-03-21 17:21:19 +03:00
parent f53181805e
commit 39655a8d7a
7 changed files with 36 additions and 30 deletions

View File

@@ -87,19 +87,18 @@ https://geektimes.ru/post/273852/ // Good tutorial for fast start in RUSSIAN
In linux you can open terminal, navigate to your programming directory, then
* git clone https://github.com/anklimov/lighthub.git
* cd lighthub
* pio init --ide clion // use your IDE, others here: http://docs.platformio.org/en/latest/ide.html
* export PLATFORMIO_BUILD_FLAGS="-DMY_CONFIG_SERVER=192.168.1.1 -DWATCH_DOG_TICKER_DISABLE=1"
set ip address of your configuration server and disable wdt feature in case bootloader of your mega2560 is stock
* pio run -e due // this will build firmware for arduino due board
* rm -Rf .piolibdeps // this will clean libraries folder. Try it if you have compilation problem
* pio run -e megaatmega2560 //build for arduino mega
* pio run -e due -t upload //build and upload firmware to arduino due
# Custom build flags
* MY_CONFIG_SERVER=192.168.1.1 // address of external JSON-config http://192.168.1.1/de-ad-be-ef-fe-00.config.json
* WATCH_DOG_TICKER_DISABLE=1 //disable wdt feature
* USE_1W_PIN=49 // use direct connection to 1W devices, no I2C bridge DS2482-100
export PLATFORMIO_BUILD_FLAGS="-DMY_CONFIG_SERVER=192.168.1.1 -DWATCH_DOG_TICKER_DISABLE=1 -DUSE_1W_PIN=49"

View File

@@ -132,9 +132,6 @@ EthernetClient ethClient;
#include "dmx.h"
#endif
#define Q(x) #x
#define QUOTE(x) Q(x)
#ifndef PIO_SRC_REV
#define PIO_SRC_REV v0.98
#endif
@@ -148,7 +145,7 @@ EthernetClient ethClient;
extern Artnet *artnet;
#endif
#ifdef _sd
#ifdef SD_CARD_INSERTED
#include "sd_card_w5100.h"
#endif
@@ -904,12 +901,15 @@ void postTransmission()
}
void setup_main() {
cmdInit(115200);
cmdInit(uint32_t(SERIAL_BAUD));
Serial.print(F("\nLazyhome.ru LightHub controller "));
Serial.println(F(QUOTE(PIO_SRC_REV)));
#ifdef WATCH_DOG_TICKER_DISABLE
Serial.println(F("WATCHDOG TICKER DISABLED"));
#endif
#ifdef _sd
#ifdef SD_CARD_INSERTED
sd_card_w5100_setup();
#endif

View File

@@ -5,7 +5,10 @@
#ifndef LIGHTHUB_MAIN_H
#define LIGHTHUB_MAIN_H
#endif //LIGHTHUB_MAIN_H
#ifndef SERIAL_BAUD
#define SERIAL_BAUD 115200
#endif
#include "Arduino.h"
#include "DallasTemperature.h"
@@ -45,3 +48,4 @@ void inputLoop(void);
void modbusLoop(void);
void thermoLoop(void);
short thermoSetCurTemp(char * name, short t);
#endif //LIGHTHUB_MAIN_H

View File

@@ -32,3 +32,6 @@
#ifndef _dmxout
#undef _artnet
#endif
#define Q(x) #x
#define QUOTE(x) Q(x)

View File

@@ -80,10 +80,13 @@ while (net && net->wireSearch(term[t_count])>0 && (t_count<t_max) && finish > mi
int owSetup(owChangedType owCh) {
//// todo - move memory allocation to here
#ifdef _2482
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
Serial.println(F("DS2482_100_I2C_TO_1W_BRIDGE init"));
net = new OneWire;
#else
net = new OneWire (ONE_WIRE_BUS);
Serial.print(F("One wire setup on PIN:"));
Serial.println(QUOTE(USE_1W_PIN));
net = new OneWire (USE_1W_PIN);
#endif
@@ -97,7 +100,7 @@ wstat = new uint16_t [t_max];
#ifdef _2482
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
Wire.begin();
if (net->checkPresence())
{

View File

@@ -47,8 +47,6 @@ e-mail anklimov@gmail.com
#define recheck_interval 5
#define check_circle 2000/t_count
#define t_max 20 //Maximum number of 1w devices
#define TEMPERATURE_PRECISION 9
@@ -59,13 +57,12 @@ e-mail anklimov@gmail.com
extern aJsonObject *owArr;
typedef void (*owChangedType) (int , DeviceAddress, int) ;
#ifndef USE_1W_PIN
#define DS2482_100_I2C_TO_1W_BRIDGE // HW driver
#endif
#define _2482 // HW driver
#ifdef _2482
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
#include <Wire.h>
#else
#define ONE_WIRE_BUS A0
#endif
extern OneWire *net;

View File

@@ -10,8 +10,8 @@
[platformio]
src_dir = lighthub
env_default =
megaatmega2560
; due
; megaatmega2560
due
[env:due]
platform = atmelsam