Merge pull request #5 from livello/pio-1

platformio lib_deps correction
This commit is contained in:
2018-03-16 22:42:17 +03:00
committed by GitHub
9 changed files with 1655 additions and 1256 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
.piolibdeps
.clang_complete
.gcc-flags.json
CMakeListsPrivate.txt

View File

@@ -53,7 +53,7 @@ For patched libraries, appropriate GitHub repo URL provided:
Portation from AVR Mega 2560 to SAM3X8E (Arduino DUE) done since v 0.96
#Platforms specific details:
# Platforms specific details:
AVR version is basic and have all functions
*DMX-out is software (DMXSimple) on pin3
@@ -74,3 +74,7 @@ Need to use compiler directive -D Wiz5500 and https://github.com/anklimov/Ethern
First attempt to use platformio toolchain for compiling (work not completed yet)
# Due compilation issue "USART0_Handler redefinition"
Please, open /variants/arduino_due_x/variant.cpp file, then edit USART0_Handler method definition like this
void USART0_Handler(void) __attribute__((weak));

File diff suppressed because it is too large Load Diff

1217
lighthub/main.cpp Normal file

File diff suppressed because it is too large Load Diff

47
lighthub/main.h Normal file
View File

@@ -0,0 +1,47 @@
//
// Created by livello on 13.03.18.
//
#ifndef LIGHTHUB_MAIN_H
#define LIGHTHUB_MAIN_H
#endif //LIGHTHUB_MAIN_H
#include "Arduino.h"
#include "DallasTemperature.h"
void watchdogSetup(void);
void callback(char* topic, byte* payload, unsigned int length);
#ifndef __ESP__
void printIPAddress();
#endif
void printMACAddress();
void restoreState();
int lanLoop();
void Changed (int i, DeviceAddress addr, int val);
void modbusIdle(void);
void _handleHelp(int arg_cnt, char **args);
void _kill(int arg_cnt, char **args);
void parseConfig();
void _loadConfig (int arg_cnt, char **args);
int loadConfig (int arg_cnt, char **args);
void _mqttConfigReq (int arg_cnt, char **args);
int mqttConfigReq (int arg_cnt, char **args);
int mqttConfigResp (char * as);
void _saveConfig(int arg_cnt, char **args);
void _setConfig(int arg_cnt, char **args);
void _getConfig(int arg_cnt, char **args);
void printBool (bool arg);
void saveFlash(short n, char* str);
void loadFlash(short n, char* str);
int getConfig (int arg_cnt, char **args);
void preTransmission();
void postTransmission();
void setup_main();
void loop_main();
void owIdle(void);
void modbusIdle(void);
void inputLoop(void);
void modbusLoop(void);
void thermoLoop(void);
short thermoSetCurTemp(char * name, short t);

212
lighthub/sd_card_w5100.cpp Normal file
View File

@@ -0,0 +1,212 @@
//
// Created by livello on 14.10.17.
//
/*
SD card test
This example shows how use the utility libraries on which the'
SD library is based in order to get info about your SD card.
Very useful for testing a card when you're not sure whether its working or not.
The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
** CS - depends on your SD card shield or module.
Pin 4 used here for consistency with other Arduino examples
created 28 Mar 2011
by Limor Fried
modified 9 Apr 2012
by Tom Igoe
*/
//template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; }
#include "sd_card_w5100.h"
#include <SD.h>
#include <SPI.h>
//#include <iostream>
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile sdFile;
File myFile;
char *entireFileContents;
// Arduino Ethernet shield: pin 4
const int chipSelect = 4;
void bench() {
/* uint8_t buf[BUF_SIZE];
long maxLatency,minLatency,totalLatency,temp_DHT22;
myFile = SD.open("test.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
// close the file:
} else {
// if the file didn'temp_DHT22 open, print an error:
Serial.println("error opening test.txt");
}
for (uint16_t i = 0; i < (BUF_SIZE - 2); i++) {
buf[i] = 'A' + (i % 26);
}
buf[BUF_SIZE - 2] = '\r';
buf[BUF_SIZE - 1] = '\n';
Serial.println("File size MB: ");
Serial.print(FILE_SIZE_MB);
Serial.println("Buffer size ");
Serial.print(BUF_SIZE);
Serial.println("Starting write test, please wait.");
// do write test
uint32_t n = FILE_SIZE / sizeof(buf);
Serial.println("write speed and latency");
Serial.print(" speed,max,min,avg");
Serial.print(" KB/Sec,usec,usec,usec");
for (uint8_t nTest = 0; nTest < WRITE_PASS_COUNT; nTest++) {
// myFile.truncate(0);
maxLatency = 0;
minLatency = 9999999;
totalLatency = 0;
temp_DHT22 = millis();
for (uint32_t i = 0; i < n; i++) {
uint32_t m = micros();
if (myFile.write(buf, sizeof(buf)) != sizeof(buf)) {
Serial.println("write failed");
}
m = micros() - m;
if (maxLatency < m) {
maxLatency = m;
}
if (minLatency > m) {
minLatency = m;
}
totalLatency += m;
}
myFile.flush();
temp_DHT22 = millis() - temp_DHT22;
int s = myFile.size();
Serial.println(s / temp_DHT22);
Serial.print(',');
Serial.print(maxLatency);
Serial.print(',');
Serial.print(minLatency);
Serial.print(',');
Serial.print(totalLatency / n);
}*/
myFile.close();
Serial.println("done.");
}
char* sdW5100_readEntireFile(const char *filename) {
SdFile requestedFile;
if(requestedFile.open(sdFile,filename)) {
Serial.println("Success open INDEX.HTM:");
long time_started = millis();
entireFileContents = new char[requestedFile.fileSize()];
requestedFile.read(entireFileContents,requestedFile.fileSize());
Serial.print(millis()-time_started);
Serial.println(" milliseconds takes to read.");
return entireFileContents;
}
else {
Serial.print("Failed sdFile.open ");
Serial.println(filename);
}
return NULL;
}
uint32_t sdW5100_getFileSize(const char *filename){
SdFile requestedFile;
if(requestedFile.open(sdFile,filename))
return requestedFile.fileSize();
else
return 0;
}
void sd_card_w5100_setup() {
Serial.print("\nInitializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(chipSelect, OUTPUT);
if (!card.init(SPI_FULL_SPEED, chipSelect)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card is inserted?");
Serial.println("* Is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
return;
} else {
Serial.println("Wiring is correct and a card is present.");
}
// print the type of card
Serial.print("\nCard type: ");
switch (card.type()) {
case SD_CARD_TYPE_SD1:
Serial.println("SD1");
break;
case SD_CARD_TYPE_SD2:
Serial.println("SD2");
break;
case SD_CARD_TYPE_SDHC:
Serial.println("SDHC");
break;
default:
Serial.println("Unknown");
}
// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
if (!volume.init(card)) {
Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
return;
}
// print the type and size of the first FAT-type volume
uint32_t volumesize;
Serial.print("\nVolume type is FAT");
Serial.println(volume.fatType(), DEC);
Serial.println();
volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
volumesize *= 512; // SD card blocks are always 512 bytes
Serial.print("Volume size (bytes): ");
Serial.println(volumesize);
Serial.print("Volume size (Kbytes): ");
volumesize /= 1024;
Serial.println(volumesize);
Serial.print("Volume size (Mbytes): ");
volumesize /= 1024;
Serial.println(volumesize);
Serial.println("\nFiles found on the card (name, date and size in bytes): ");
sdFile.openRoot(volume);
// list all files in the card with date and size
sdFile.ls(LS_R | LS_DATE | LS_SIZE);
Serial.println(sdW5100_readEntireFile("INDEX.HTM"));
}

15
lighthub/sd_card_w5100.h Normal file
View File

@@ -0,0 +1,15 @@
//
// Created by livello on 14.10.17.
//
#include <stdint.h>
#ifndef NODEMCU_STOPWATCH_SD_CARD_W5100_H
#define NODEMCU_STOPWATCH_SD_CARD_W5100_H
#endif //NODEMCU_STOPWATCH_SD_CARD_W5100_H
void sd_card_w5100_setup();
void cidDmp();
void bench();
char* sdW5100_readEntireFile(const char *filename);
uint32_t sdW5100_getFileSize(const char *filename);

View File

@@ -1,4 +1,4 @@
; PlatformIO Project Configuration File
; PlatformIO Project Configuration File (for copy and paste)
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
@@ -9,18 +9,87 @@
; http://docs.platformio.org/page/projectconf.html
[platformio]
src_dir = lighthub
env_default =
megaatmega2560
; due
[env:due]
platform = atmelsam
framework = arduino
board = due
lib_ldf_mode = chain+
build_flags = !echo -n "-DPIO_SRC_REV="$(git rev-parse --short HEAD)
lib_deps =
https://github.com/sebnil/DueFlashStorage
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxDue
https://github.com/arduino-libraries/ArduinoHttpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/Ethernet
; https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
FastLED
161
322
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
build_flags =
-D Wiz5500
;lib_ldf_mode = chain+
lib_deps =
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxSimple
https://github.com/anklimov/HTTPClient
https://github.com/anklimov/httpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/DMXSerial
https://github.com/anklimov/Ethernet
https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
FastLED
161
322
[env:due-5500]
platform = atmelsam
framework = arduino
board = due
build_flags = -D Wiz5500
lib_deps =
https://github.com/sebnil/DueFlashStorage
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxDue
https://github.com/arduino-libraries/ArduinoHttpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/Ethernet2
; https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
FastLED
[env:megaatmega2560-5500]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_ldf_mode = chain+
build_flags = -D Wiz5500
lib_deps =
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxSimple
https://github.com/anklimov/httpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
@@ -29,3 +98,22 @@ lib_deps =
https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
FastLED
[env:espressif8266]
platform = espressif8266
framework = arduino
board = nodemcuv2
lib_ldf_mode = chain+
lib_deps =
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/ESP-Dmx
https://github.com/arduino-libraries/ArduinoHttpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/DMXSerial
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
FastLED

View File

@@ -9,52 +9,56 @@
; http://docs.platformio.org/page/projectconf.html
[platformio]
src_dir = lighthub
[env:due]
platform = atmelsam
framework = arduino
board = due
build_flags =
-D Wiz5500
ib_deps =
https://github.com/sebnil/DueFlashStorage
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxDue
https://github.com/arduino-libraries/ArduinoHttpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/Ethernet2
https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
[env:megaatmega2560-5500]
platform = atmelavr
board = megaatmega2560
framework = arduino
build_flags = -D Wiz5500
lib_deps =
platform = atmelsam
framework = arduino
board = due
lib_deps =
https://github.com/sebnil/DueFlashStorage
; https://github.com/livello/Arduino-Temperature-Control-Library.git#1306c49
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxSimple
https://github.com/anklimov/HTTPClient
https://github.com/anklimov/DmxDue
https://github.com/arduino-libraries/ArduinoHttpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/Ethernet
https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
FastLED
[env:due-5500]
platform = atmelsam
framework = arduino
board = due
build_flags = -D Wiz5500
lib_deps =
https://github.com/sebnil/DueFlashStorage
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxDue
https://github.com/arduino-libraries/ArduinoHttpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/DMXSerial
https://github.com/anklimov/Ethernet2
https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps =
[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps =
; https://github.com/livello/Arduino-Temperature-Control-Library.git#1306c49
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxSimple
https://github.com/anklimov/HTTPClient
https://github.com/anklimov/httpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
@@ -63,31 +67,32 @@ src_dir = lighthub
https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
FastLED
[env:megaatmega2560-5500]
platform = atmelavr
board = megaatmega2560
framework = arduino
build_flags = -D Wiz5500
lib_deps =
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxSimple
https://github.com/anklimov/httpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/DMXSerial
https://github.com/anklimov/Ethernet2
https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
[env:due]
platform = atmelsam
framework = arduino
board = due
ib_deps =
https://github.com/sebnil/DueFlashStorage
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/DmxDue
https://github.com/arduino-libraries/ArduinoHttpClient
https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino
https://github.com/anklimov/ModbusMaster
https://github.com/anklimov/Ethernet
https://github.com/PaulStoffregen/SPI.git
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git
[env:espressif8266]
platform= espressif8266
framework = arduino
board = nodemcuv2
ib_deps =
[env:espressif8266]
platform = espressif8266
framework = arduino
board = nodemcuv2
lib_deps =
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/ESP-Dmx
@@ -98,3 +103,4 @@ src_dir = lighthub
https://github.com/anklimov/DMXSerial
https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git