Added clang-format (#623)

* added .clang-format
* added names to travis jobs
removed deprecated travis option
* check github action
* added .gitignore
This commit is contained in:
Leon Kiefer authored and GitHub committed 2020-06-09 16:09:23 -05:00
1 parent 661ef9c55e
commit 10a9d00aaf
59 files changed
+2892 -3640

No files matched your search

+99 -99
View File
@@ -48,10 +48,10 @@
*/
/*-------------DEFINE GATEWAY NAME BELOW IT CAN ALSO BE DEFINED IN platformio.ini----------------*/
#ifndef Gateway_Name
#define Gateway_Name "OpenMQTTGateway"
# define Gateway_Name "OpenMQTTGateway"
#endif
#ifndef Gateway_Short_Name
#define Gateway_Short_Name "OMG"
# define Gateway_Short_Name "OMG"
#endif
#define Base_Topic "home/"
@@ -60,35 +60,35 @@
//#define NetworkAdvancedSetup true //uncomment if you want to set advanced network parameters for arduino boards, not uncommented you can set the IP and mac only
#ifdef NetworkAdvancedSetup // for arduino boards advanced config
#if defined(ESP8266)||defined(ESP32)
const byte ip[] = { 192, 168, 1, 99 }; //ip adress of the gateway, already defined for arduino below
#endif
const byte gateway[] = { 0, 0, 0, 0 };
const byte Dns[] = { 0, 0, 0, 0 };
const byte subnet[] = { 255, 255, 255, 0 };
# if defined(ESP8266) || defined(ESP32)
const byte ip[] = {192, 168, 1, 99}; //ip adress of the gateway, already defined for arduino below
# endif
const byte gateway[] = {0, 0, 0, 0};
const byte Dns[] = {0, 0, 0, 0};
const byte subnet[] = {255, 255, 255, 0};
#endif
#if defined(ESP8266)||defined(ESP32) // for nodemcu, weemos and esp8266
//#define ESPWifiManualSetup true //uncomment you don't want to use wifimanager for your credential settings on ESP
#if defined(ESP8266) || defined(ESP32) // for nodemcu, weemos and esp8266
//#define ESPWifiManualSetup true //uncomment you don't want to use wifimanager for your credential settings on ESP
#else // for arduino boards
const byte ip[] = { 192, 168, 1, 99 };
const byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0x54, 0x95 }; //W5100 ethernet shield mac adress
const byte ip[] = {192, 168, 1, 99};
const byte mac[] = {0xDE, 0xED, 0xBA, 0xFE, 0x54, 0x95}; //W5100 ethernet shield mac adress
#endif
#if defined(ESPWifiManualSetup) // for nodemcu, weemos and esp8266
#define wifi_ssid "wifi ssid"
#define wifi_password "wifi password"
# define wifi_ssid "wifi ssid"
# define wifi_password "wifi password"
#endif
#define WifiManager_password "your_password" //this is going to be the WPA2-PSK password for the initial setup access point
#define WifiManager_ssid Gateway_Name //this is the network name of the initial setup access point
#define WifiManager_password "your_password" //this is going to be the WPA2-PSK password for the initial setup access point
#define WifiManager_ssid Gateway_Name //this is the network name of the initial setup access point
#define WifiManager_ConfigPortalTimeOut 120
#define WifiManager_TimeOut 5
#define WifiManager_TimeOut 5
/*-------------DEFINE YOUR ADVANCED NETWORK PARAMETERS BELOW----------------*/
//#define MDNS_SD //uncomment if you want to use mdns for discovering automatically your ip server, please note that MDNS with ESP32 can cause the BLE to not work
#define maxConnectionRetry 10 //maximum MQTT connection attempts before going to wifimanager setup if never connected once
#define maxConnectionRetryWifi 5 //maximum Wifi connection attempts with existing credential at start (used to bypass ESP32 issue on wifi connect)
#define maxConnectionRetry 10 //maximum MQTT connection attempts before going to wifimanager setup if never connected once
#define maxConnectionRetryWifi 5 //maximum Wifi connection attempts with existing credential at start (used to bypass ESP32 issue on wifi connect)
//set minimum quality of signal so it ignores AP's under that quality
#define MinimumWifiSignalQuality 8
@@ -97,11 +97,11 @@
//MQTT Parameters definition
//#define mqtt_server_name "www.mqtt_broker.com" // instead of defining the server by its IP you can define it by its name, uncomment this line and set the correct MQTT server host name
#if defined(ESP8266) || defined(ESP32) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
#define parameters_size 20
#define mqtt_topic_max_size 100
# define parameters_size 20
# define mqtt_topic_max_size 100
#else
#define parameters_size 15
#define mqtt_topic_max_size 50
# define parameters_size 15
# define mqtt_topic_max_size 50
#endif
char mqtt_user[parameters_size] = "your_username"; // not compulsory only if your broker needs authentication
char mqtt_pass[parameters_size] = "your_password"; // not compulsory only if your broker needs authentication
@@ -110,9 +110,9 @@ char mqtt_port[6] = "1883";
char mqtt_topic[mqtt_topic_max_size] = Base_Topic;
char gateway_name[parameters_size * 2] = Gateway_Name;
#if defined(ESP8266)||defined(ESP32)
#define ATTEMPTS_BEFORE_BG 10 // Number of wifi connection attempts before going to BG protocol
#define ATTEMPTS_BEFORE_B 20 // Number of wifi connection attempts before going to B protocol
#if defined(ESP8266) || defined(ESP32)
# define ATTEMPTS_BEFORE_BG 10 // Number of wifi connection attempts before going to BG protocol
# define ATTEMPTS_BEFORE_B 20 // Number of wifi connection attempts before going to B protocol
#endif
/*------------------DEEP SLEEP parameters ------------------*/
@@ -120,34 +120,34 @@ char gateway_name[parameters_size * 2] = Gateway_Name;
//DEFAULT_LOW_POWER_MODE 1 to activate deep sleep with LCD ON when a function is processing,
//DEFAULT_LOW_POWER_MODE 2 to activate deep sleep with LED ON when a function is processing (LCD is turned OFF)
#ifdef ESP32
#ifndef SLEEP_BUTTON
#define SLEEP_BUTTON 33
#endif
#ifndef DEFAULT_LOW_POWER_MODE
#define DEFAULT_LOW_POWER_MODE 0
#endif
#ifndef LOW_POWER_LED
#define LOW_POWER_LED 2
#endif
#ifndef LOW_POWER_LED_OFF
#define LOW_POWER_LED_OFF 1
#endif
# ifndef SLEEP_BUTTON
# define SLEEP_BUTTON 33
# endif
# ifndef DEFAULT_LOW_POWER_MODE
# define DEFAULT_LOW_POWER_MODE 0
# endif
# ifndef LOW_POWER_LED
# define LOW_POWER_LED 2
# endif
# ifndef LOW_POWER_LED_OFF
# define LOW_POWER_LED_OFF 1
# endif
int low_power_mode = DEFAULT_LOW_POWER_MODE;
#endif
// WIFI mode, uncomment to force a wifi mode, if not uncommented the ESP will connect without a mode forced
// if there is a reconnection issue it will try to connect with G mode and if not working with B mode
#ifdef ESP32
#include "esp_wifi.h"
uint8_t wifiProtocol = 0; // default mode, automatic selection
//uint8_t wifiProtocol = WIFI_PROTOCOL_11B;
//uint8_t wifiProtocol = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G; // can't have only one https://github.com/espressif/esp-idf/issues/702
//uint8_t wifiProtocol = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N; // can't have only one https://github.com/espressif/esp-idf/issues/702
# include "esp_wifi.h"
uint8_t wifiProtocol = 0; // default mode, automatic selection
//uint8_t wifiProtocol = WIFI_PROTOCOL_11B;
//uint8_t wifiProtocol = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G; // can't have only one https://github.com/espressif/esp-idf/issues/702
//uint8_t wifiProtocol = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N; // can't have only one https://github.com/espressif/esp-idf/issues/702
#elif ESP8266
uint8_t wifiProtocol = 0; // default mode, automatic selection
//uint8_t wifiProtocol = WIFI_PHY_MODE_11B;
//uint8_t wifiProtocol = WIFI_PHY_MODE_11G;
//uint8_t wifiProtocol = WIFI_PHY_MODE_11N;
uint8_t wifiProtocol = 0; // default mode, automatic selection
//uint8_t wifiProtocol = WIFI_PHY_MODE_11B;
//uint8_t wifiProtocol = WIFI_PHY_MODE_11G;
//uint8_t wifiProtocol = WIFI_PHY_MODE_11N;
#endif
/*-------------DEFINE THE MODULES YOU WANT BELOW----------------*/
@@ -183,11 +183,11 @@ int low_power_mode = DEFAULT_LOW_POWER_MODE;
//#define ZradioCC1101 "CC1101" //ESP8266, ESP32
/*-------------DEFINE YOUR MQTT ADVANCED PARAMETERS BELOW----------------*/
#define version_Topic "/version"
#define will_Topic "/LWT"
#define will_QoS 0
#define will_Retain true
#define will_Message "offline"
#define version_Topic "/version"
#define will_Topic "/LWT"
#define will_QoS 0
#define will_Retain true
#define will_Message "offline"
#define Gateway_AnnouncementMsg "online"
#define jsonPublishing true //comment if you don't want to use Json publishing (one topic for all the parameters)
@@ -195,7 +195,7 @@ int low_power_mode = DEFAULT_LOW_POWER_MODE;
#define jsonReceiving true //comment if you don't want to use Json reception analysis
//#define simplePublishing true //comment if you don't want to use simple publishing (one topic for one parameter)
//example
//example
// home/OpenMQTTGateway_ESP32_DEVKIT/BTtoMQTT/4XXXXXXXXXX4/rssi -63.0
// home/OpenMQTTGateway_ESP32_DEVKIT/BTtoMQTT/4XXXXXXXXXX4/servicedata fe0000000000000000000000000000000000000000
//#define simpleReceiving true //comment if you don't want to use old way reception analysis
@@ -203,49 +203,49 @@ int low_power_mode = DEFAULT_LOW_POWER_MODE;
/*-------------DEFINE YOUR OTA PARAMETERS BELOW----------------*/
#define ota_hostname Gateway_Name
#define ota_password "OTAPASSWORD"
#define ota_port 8266
#define ota_port 8266
/*-------------DEFINE PINs FOR STATUS LEDs----------------*/
#ifndef led_receive
#ifdef ESP8266
#define led_receive 40
#elif ESP32
#define led_receive 40
#elif __AVR_ATmega2560__ //arduino mega
#define led_receive 40
#else //arduino uno/nano
#define led_receive 40
#endif
# ifdef ESP8266
# define led_receive 40
# elif ESP32
# define led_receive 40
# elif __AVR_ATmega2560__ //arduino mega
# define led_receive 40
# else //arduino uno/nano
# define led_receive 40
# endif
#endif
#ifndef led_send
#ifdef ESP8266
#define led_send 42
#elif ESP32
#define led_send 42
#elif __AVR_ATmega2560__ //arduino mega
#define led_send 42
#else //arduino uno/nano
#define led_send 42
#endif
# ifdef ESP8266
# define led_send 42
# elif ESP32
# define led_send 42
# elif __AVR_ATmega2560__ //arduino mega
# define led_send 42
# else //arduino uno/nano
# define led_send 42
# endif
#endif
#ifndef led_info
#ifdef ESP8266
#define led_info 44
#elif ESP32
#define led_info 44
#elif __AVR_ATmega2560__ //arduino mega
#define led_info 44
#else //arduino uno/nano
#define led_info 44
#endif
# ifdef ESP8266
# define led_info 44
# elif ESP32
# define led_info 44
# elif __AVR_ATmega2560__ //arduino mega
# define led_info 44
# else //arduino uno/nano
# define led_info 44
# endif
#endif
#ifndef TRIGGER_PIN
#ifdef ESP8266
#define TRIGGER_PIN 14 // pin D5 as full reset button (long press >10s)
#elif ESP32
#define TRIGGER_PIN 0 // boot button as full reset button (long press >10s)
#endif
# ifdef ESP8266
# define TRIGGER_PIN 14 // pin D5 as full reset button (long press >10s)
# elif ESP32
# define TRIGGER_PIN 0 // boot button as full reset button (long press >10s)
# endif
#endif
// VCC ------------D|-----------/\/\/\/\ ----------------- Arduino PIN
@@ -255,19 +255,19 @@ int low_power_mode = DEFAULT_LOW_POWER_MODE;
/*-------------------CHANGING THEM IS NOT COMPULSORY-----------------------*/
/*----------------------------USER PARAMETERS-----------------------------*/
#ifdef ZgatewaySRFB
#define SERIAL_BAUD 19200
# define SERIAL_BAUD 19200
#else
#define SERIAL_BAUD 115200
# define SERIAL_BAUD 115200
#endif
/*--------------MQTT general topics-----------------*/
// global MQTT subject listened by the gateway to execute commands (send RF, IR or others)
#define subjectMQTTtoX "/commands/#"
#define subjectMultiGTWKey "toMQTT"
#define subjectGTWSendKey "MQTTto"
#define subjectMQTTtoX "/commands/#"
#define subjectMultiGTWKey "toMQTT"
#define subjectGTWSendKey "MQTTto"
// key used for launching commands to the gateway
#define restartCmd "restart"
#define eraseCmd "erase"
#define restartCmd "restart"
#define eraseCmd "erase"
// uncomment the line below to integrate msg value into the subject when receiving
//#define valueAsASubject true
@@ -276,16 +276,16 @@ int low_power_mode = DEFAULT_LOW_POWER_MODE;
#define time_avoid_duplicate 3000 // if you want to avoid duplicate mqtt message received set this to > 0, the value is the time in milliseconds during which we don't publish duplicates
#if defined(ESP8266) || defined(ESP32) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
#define JSON_MSG_BUFFER 512 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#define ARDUINOJSON_USE_LONG_LONG 1
# define JSON_MSG_BUFFER 512 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
# define ARDUINOJSON_USE_LONG_LONG 1
#else // boards with smaller memory
#define JSON_MSG_BUFFER 64 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
# define JSON_MSG_BUFFER 64 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#endif
#define TimeBetweenReadingSYS 120 // time between (s) system readings (like memory)
#define TimeBeforeMQTTconnect 10 // time estimated (s) before the board is connected to MQTT
#define subjectSYStoMQTT "/SYStoMQTT"
#define subjectMQTTtoSYSset "/commands/MQTTtoSYS/config"
#define TimeBeforeMQTTconnect 10 // time estimated (s) before the board is connected to MQTT
#define subjectSYStoMQTT "/SYStoMQTT"
#define subjectMQTTtoSYSset "/commands/MQTTtoSYS/config"
/*-------------------DEFINE LOG LEVEL----------------------*/
#define LOG_LEVEL LOG_LEVEL_NOTICE