mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 10:19:29 +02:00
Add ifdefs for all prints. Remove example folders
This commit is contained in:
parent
28fc1da7c0
commit
0c62bf16df
49 changed files with 58 additions and 1974 deletions
|
@ -31,7 +31,7 @@
|
||||||
//#define SOLAX_CAN //Enable this line to emulate a "SolaX Triple Power LFP" over CAN bus
|
//#define SOLAX_CAN //Enable this line to emulate a "SolaX Triple Power LFP" over CAN bus
|
||||||
|
|
||||||
/* Other options */
|
/* Other options */
|
||||||
//#define DEBUG_VIA_USB //Enable this line to have the USB port output serial diagnostic data while program runs
|
//#define DEBUG_VIA_USB //Enable this line to have the USB port output serial diagnostic data while program runs (WARNING, raises CPU load, do not use for production)
|
||||||
//#define INTERLOCK_REQUIRED //Nissan LEAF specific setting, if enabled requires both high voltage conenctors to be seated before starting
|
//#define INTERLOCK_REQUIRED //Nissan LEAF specific setting, if enabled requires both high voltage conenctors to be seated before starting
|
||||||
//#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence
|
//#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence
|
||||||
//#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation
|
//#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation
|
||||||
|
|
|
@ -562,6 +562,10 @@ void send_can_battery() {
|
||||||
if (battery_awake) {
|
if (battery_awake) {
|
||||||
//Send 20ms message
|
//Send 20ms message
|
||||||
if (currentMillis - previousMillis20 >= interval20) {
|
if (currentMillis - previousMillis20 >= interval20) {
|
||||||
|
|
||||||
|
if (currentMillis - previousMillis20 >= interval20 + 10) {
|
||||||
|
set_event(EVENT_CAN_OVERRUN, interval20);
|
||||||
|
}
|
||||||
previousMillis20 = currentMillis;
|
previousMillis20 = currentMillis;
|
||||||
|
|
||||||
if (startup_counter_contactor < 160) {
|
if (startup_counter_contactor < 160) {
|
||||||
|
@ -702,7 +706,9 @@ void send_can_battery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("BMW i3 battery selected");
|
Serial.println("BMW i3 battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_max_design_voltage_dV = 4040; // 404.4V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 4040; // 404.4V, over this, charging is not possible (goes into forced discharge)
|
||||||
system_min_design_voltage_dV = 2800; // 280.0V under this, discharging further is disabled
|
system_min_design_voltage_dV = 2800; // 280.0V under this, discharging further is disabled
|
||||||
|
|
|
@ -209,7 +209,9 @@ void send_can_battery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Chademo battery selected");
|
Serial.println("Chademo battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_max_design_voltage_dV = 4040; // 404.4V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 4040; // 404.4V, over this, charging is not possible (goes into forced discharge)
|
||||||
system_min_design_voltage_dV = 2000; // 200.0V under this, discharging further is disabled
|
system_min_design_voltage_dV = 2000; // 200.0V under this, discharging further is disabled
|
||||||
|
|
|
@ -118,7 +118,9 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BMU_Detected) {
|
if (!BMU_Detected) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("BMU not detected, check wiring!");
|
Serial.println("BMU not detected, check wiring!");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_VIA_USB
|
#ifdef DEBUG_VIA_USB
|
||||||
|
@ -231,7 +233,9 @@ void send_can_battery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Mitsubishi i-MiEV / Citroen C-Zero / Peugeot Ion battery selected");
|
Serial.println("Mitsubishi i-MiEV / Citroen C-Zero / Peugeot Ion battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_max_design_voltage_dV = 3600; // 360.0V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 3600; // 360.0V, over this, charging is not possible (goes into forced discharge)
|
||||||
system_min_design_voltage_dV = 3160; // 316.0V under this, discharging further is disabled
|
system_min_design_voltage_dV = 3160; // 316.0V under this, discharging further is disabled
|
||||||
|
|
|
@ -596,7 +596,9 @@ void send_can_battery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Kia Niro / Hyundai Kona 64kWh battery selected");
|
Serial.println("Kia Niro / Hyundai Kona 64kWh battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_max_design_voltage_dV = 4040; // 404.0V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 4040; // 404.0V, over this, charging is not possible (goes into forced discharge)
|
||||||
system_min_design_voltage_dV = 3100; // 310.0V under this, discharging further is disabled
|
system_min_design_voltage_dV = 3100; // 310.0V under this, discharging further is disabled
|
||||||
|
|
|
@ -247,7 +247,9 @@ void send_can_battery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Renault Kangoo battery selected");
|
Serial.println("Renault Kangoo battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_max_design_voltage_dV = 4040; // 404.0V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 4040; // 404.0V, over this, charging is not possible (goes into forced discharge)
|
||||||
system_min_design_voltage_dV = 3100; // 310.0V under this, discharging further is disabled
|
system_min_design_voltage_dV = 3100; // 310.0V under this, discharging further is disabled
|
||||||
|
|
|
@ -153,7 +153,9 @@ void send_can_battery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Renault Zoe battery selected");
|
Serial.println("Renault Zoe battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_max_design_voltage_dV = 4040; // 404.0V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 4040; // 404.0V, over this, charging is not possible (goes into forced discharge)
|
||||||
system_min_design_voltage_dV = 3100; // 310.0V under this, discharging further is disabled
|
system_min_design_voltage_dV = 3100; // 310.0V under this, discharging further is disabled
|
||||||
|
|
|
@ -175,7 +175,9 @@ uint8_t CalculateCRC8(CAN_frame_t rx_frame) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Hyundai Santa Fe PHEV battery selected");
|
Serial.println("Hyundai Santa Fe PHEV battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_max_design_voltage_dV = 4040; // 404.0V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 4040; // 404.0V, over this, charging is not possible (goes into forced discharge)
|
||||||
system_min_design_voltage_dV = 3100; // 310.0V under this, discharging further is disabled
|
system_min_design_voltage_dV = 3100; // 310.0V under this, discharging further is disabled
|
||||||
|
|
|
@ -274,11 +274,15 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
|
|
||||||
//Check if BMS is in need of recalibration
|
//Check if BMS is in need of recalibration
|
||||||
if (nominal_full_pack_energy > 1 && nominal_full_pack_energy < REASONABLE_ENERGYAMOUNT) {
|
if (nominal_full_pack_energy > 1 && nominal_full_pack_energy < REASONABLE_ENERGYAMOUNT) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Warning: kWh remaining " + String(nominal_full_pack_energy) +
|
Serial.println("Warning: kWh remaining " + String(nominal_full_pack_energy) +
|
||||||
" reported by battery not plausible. Battery needs cycling.");
|
" reported by battery not plausible. Battery needs cycling.");
|
||||||
|
#endif
|
||||||
set_event(EVENT_KWH_PLAUSIBILITY_ERROR, nominal_full_pack_energy);
|
set_event(EVENT_KWH_PLAUSIBILITY_ERROR, nominal_full_pack_energy);
|
||||||
} else if (nominal_full_pack_energy <= 1) {
|
} else if (nominal_full_pack_energy <= 1) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Info: kWh remaining battery is not reporting kWh remaining.");
|
Serial.println("Info: kWh remaining battery is not reporting kWh remaining.");
|
||||||
|
#endif
|
||||||
set_event(EVENT_KWH_PLAUSIBILITY_ERROR, nominal_full_pack_energy);
|
set_event(EVENT_KWH_PLAUSIBILITY_ERROR, nominal_full_pack_energy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,7 +696,9 @@ void printDebugIfActive(uint8_t symbol, const char* message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Tesla Model 3 battery selected");
|
Serial.println("Tesla Model 3 battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LFP_CHEMISTRY
|
#ifdef LFP_CHEMISTRY
|
||||||
system_LFP_Chemistry = true;
|
system_LFP_Chemistry = true;
|
||||||
|
|
|
@ -83,7 +83,9 @@ void send_can_battery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Test mode with fake battery selected");
|
Serial.println("Test mode with fake battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_max_design_voltage_dV = 4040; // 404.4V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 4040; // 404.4V, over this, charging is not possible (goes into forced discharge)
|
||||||
system_min_design_voltage_dV = 2450; // 245.0V under this, discharging further is disabled
|
system_min_design_voltage_dV = 2450; // 245.0V under this, discharging further is disabled
|
||||||
|
|
|
@ -379,7 +379,9 @@ void send_can_battery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_battery(void) { // Performs one time setup at startup
|
void setup_battery(void) { // Performs one time setup at startup
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Volvo SPA XC40 Recharge / Polestar2 78kWh battery selected");
|
Serial.println("Volvo SPA XC40 Recharge / Polestar2 78kWh battery selected");
|
||||||
|
#endif
|
||||||
|
|
||||||
system_number_of_cells = 108;
|
system_number_of_cells = 108;
|
||||||
system_max_design_voltage_dV = 4540; // 454.0V, over this, charging is not possible (goes into forced discharge)
|
system_max_design_voltage_dV = 4540; // 454.0V, over this, charging is not possible (goes into forced discharge)
|
||||||
|
|
|
@ -86,7 +86,9 @@ static void publish_cell_voltages(void) {
|
||||||
serializeJson(doc, mqtt_msg, sizeof(mqtt_msg));
|
serializeJson(doc, mqtt_msg, sizeof(mqtt_msg));
|
||||||
|
|
||||||
if (!mqtt_publish(state_topic.c_str(), mqtt_msg, false)) {
|
if (!mqtt_publish(state_topic.c_str(), mqtt_msg, false)) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Cell voltage MQTT msg could not be sent");
|
Serial.println("Cell voltage MQTT msg could not be sent");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
doc.clear();
|
doc.clear();
|
||||||
}
|
}
|
||||||
|
@ -161,7 +163,9 @@ static void publish_common_info(void) {
|
||||||
|
|
||||||
serializeJson(doc, mqtt_msg);
|
serializeJson(doc, mqtt_msg);
|
||||||
if (!mqtt_publish(state_topic.c_str(), mqtt_msg, false)) {
|
if (!mqtt_publish(state_topic.c_str(), mqtt_msg, false)) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Common info MQTT msg could not be sent");
|
Serial.println("Common info MQTT msg could not be sent");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
doc.clear();
|
doc.clear();
|
||||||
}
|
}
|
||||||
|
@ -169,6 +173,7 @@ static void publish_common_info(void) {
|
||||||
|
|
||||||
/* This is called whenever a subscribed topic changes (hopefully) */
|
/* This is called whenever a subscribed topic changes (hopefully) */
|
||||||
static void callback(char* topic, byte* payload, unsigned int length) {
|
static void callback(char* topic, byte* payload, unsigned int length) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.print("Message arrived [");
|
Serial.print("Message arrived [");
|
||||||
Serial.print(topic);
|
Serial.print(topic);
|
||||||
Serial.print("] ");
|
Serial.print("] ");
|
||||||
|
@ -176,28 +181,37 @@ static void callback(char* topic, byte* payload, unsigned int length) {
|
||||||
Serial.print((char)payload[i]);
|
Serial.print((char)payload[i]);
|
||||||
}
|
}
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we lose the connection, get it back and re-sub */
|
/* If we lose the connection, get it back and re-sub */
|
||||||
static void reconnect() {
|
static void reconnect() {
|
||||||
// attempt one reconnection
|
// attempt one reconnection
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.print("Attempting MQTT connection... ");
|
Serial.print("Attempting MQTT connection... ");
|
||||||
|
#endif
|
||||||
const char* hostname = WiFi.getHostname();
|
const char* hostname = WiFi.getHostname();
|
||||||
char clientId[64]; // Adjust the size as needed
|
char clientId[64]; // Adjust the size as needed
|
||||||
snprintf(clientId, sizeof(clientId), "LilyGoClient-%s", hostname);
|
snprintf(clientId, sizeof(clientId), "LilyGoClient-%s", hostname);
|
||||||
// Attempt to connect
|
// Attempt to connect
|
||||||
if (client.connect(clientId, mqtt_user, mqtt_password)) {
|
if (client.connect(clientId, mqtt_user, mqtt_password)) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("connected");
|
Serial.println("connected");
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < mqtt_nof_subscriptions; i++) {
|
for (int i = 0; i < mqtt_nof_subscriptions; i++) {
|
||||||
client.subscribe(mqtt_subscriptions[i]);
|
client.subscribe(mqtt_subscriptions[i]);
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.print("Subscribed to: ");
|
Serial.print("Subscribed to: ");
|
||||||
Serial.println(mqtt_subscriptions[i]);
|
Serial.println(mqtt_subscriptions[i]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.print("failed, rc=");
|
Serial.print("failed, rc=");
|
||||||
Serial.print(client.state());
|
Serial.print(client.state());
|
||||||
Serial.println(" try again in 5 seconds");
|
Serial.println(" try again in 5 seconds");
|
||||||
|
#endif
|
||||||
// Wait 5 seconds before retrying
|
// Wait 5 seconds before retrying
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +219,9 @@ static void reconnect() {
|
||||||
void init_mqtt(void) {
|
void init_mqtt(void) {
|
||||||
client.setServer(MQTT_SERVER, MQTT_PORT);
|
client.setServer(MQTT_SERVER, MQTT_PORT);
|
||||||
client.setCallback(callback);
|
client.setCallback(callback);
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("MQTT initialized");
|
Serial.println("MQTT initialized");
|
||||||
|
#endif
|
||||||
|
|
||||||
previousMillisUpdateVal = millis();
|
previousMillisUpdateVal = millis();
|
||||||
reconnect();
|
reconnect();
|
||||||
|
|
|
@ -237,7 +237,9 @@ void receive_can_solax(CAN_frame_t rx_frame) {
|
||||||
LastFrameTime = millis();
|
LastFrameTime = millis();
|
||||||
switch (STATE) {
|
switch (STATE) {
|
||||||
case (BATTERY_ANNOUNCE):
|
case (BATTERY_ANNOUNCE):
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Solax Battery State: Announce");
|
Serial.println("Solax Battery State: Announce");
|
||||||
|
#endif
|
||||||
inverterAllowsContactorClosing = false;
|
inverterAllowsContactorClosing = false;
|
||||||
SOLAX_1875.data.u8[4] = (0x00); // Inform Inverter: Contactor 0=off, 1=on.
|
SOLAX_1875.data.u8[4] = (0x00); // Inform Inverter: Contactor 0=off, 1=on.
|
||||||
for (int i = 0; i <= number_of_batteries; i++) {
|
for (int i = 0; i <= number_of_batteries; i++) {
|
||||||
|
@ -267,7 +269,9 @@ void receive_can_solax(CAN_frame_t rx_frame) {
|
||||||
CAN_WriteFrame(&SOLAX_1878);
|
CAN_WriteFrame(&SOLAX_1878);
|
||||||
CAN_WriteFrame(&SOLAX_1801); // Announce that the battery will be connected
|
CAN_WriteFrame(&SOLAX_1801); // Announce that the battery will be connected
|
||||||
STATE = CONTACTOR_CLOSED; // Jump to Contactor Closed State
|
STATE = CONTACTOR_CLOSED; // Jump to Contactor Closed State
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("Solax Battery State: Contactor Closed");
|
Serial.println("Solax Battery State: Contactor Closed");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (CONTACTOR_CLOSED):
|
case (CONTACTOR_CLOSED):
|
||||||
|
@ -293,9 +297,13 @@ void receive_can_solax(CAN_frame_t rx_frame) {
|
||||||
if (rx_frame.MsgID == 0x1871 && rx_frame.data.u64 == __builtin_bswap64(0x0500010000000000)) {
|
if (rx_frame.MsgID == 0x1871 && rx_frame.data.u64 == __builtin_bswap64(0x0500010000000000)) {
|
||||||
CAN_WriteFrame(&SOLAX_1881);
|
CAN_WriteFrame(&SOLAX_1881);
|
||||||
CAN_WriteFrame(&SOLAX_1882);
|
CAN_WriteFrame(&SOLAX_1882);
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("1871 05-frame received from inverter");
|
Serial.println("1871 05-frame received from inverter");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (rx_frame.MsgID == 0x1871 && rx_frame.data.u8[0] == (0x03)) {
|
if (rx_frame.MsgID == 0x1871 && rx_frame.data.u8[0] == (0x03)) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("1871 03-frame received from inverter");
|
Serial.println("1871 03-frame received from inverter");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
name: Arduino Library CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths-ignore:
|
|
||||||
- '**/**.md'
|
|
||||||
- '/keywords.txt'
|
|
||||||
- '/library.json'
|
|
||||||
- '/library.properties'
|
|
||||||
- '/ui'
|
|
||||||
- '/docs'
|
|
||||||
pull_request:
|
|
||||||
paths-ignore:
|
|
||||||
- '**/**.md'
|
|
||||||
- '/keywords.txt'
|
|
||||||
- '/library.json'
|
|
||||||
- '/library.properties'
|
|
||||||
- '/ui'
|
|
||||||
- '/docs'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Async_CI:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: adafruit/ci-arduino
|
|
||||||
path: ci
|
|
||||||
|
|
||||||
- name: pre-install
|
|
||||||
run: bash ci/actions_install.sh
|
|
||||||
|
|
||||||
- name: Set configuration
|
|
||||||
run: arduino-cli config set library.enable_unsafe_install true
|
|
||||||
|
|
||||||
- name: Install test dependencies
|
|
||||||
run: arduino-cli lib install --git-url https://github.com/me-no-dev/ESPAsyncWebServer --git-url https://github.com/me-no-dev/ESPAsyncTCP --git-url https://github.com/me-no-dev/AsyncTCP
|
|
||||||
|
|
||||||
- name: Skip SyncDemo Example
|
|
||||||
run: |
|
|
||||||
cd examples
|
|
||||||
cd Demo
|
|
||||||
touch .esp32.test.skip
|
|
||||||
touch .esp8266.test.skip
|
|
||||||
|
|
||||||
- name: Configure ElegantOTA to Async Mode
|
|
||||||
run: |
|
|
||||||
cd src
|
|
||||||
sed -i 's/ELEGANTOTA_USE_ASYNC_WEBSERVER 0/ELEGANTOTA_USE_ASYNC_WEBSERVER 1/' ElegantOTA.h
|
|
||||||
|
|
||||||
- name: Test Async Demo
|
|
||||||
continue-on-error: true
|
|
||||||
run: python3 ci/build_platform.py esp8266 esp32
|
|
||||||
|
|
||||||
Sync_CI:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: adafruit/ci-arduino
|
|
||||||
path: ci
|
|
||||||
|
|
||||||
- name: pre-install
|
|
||||||
run: bash ci/actions_install.sh
|
|
||||||
|
|
||||||
- name: Skip AsyncDemo Example
|
|
||||||
run: |
|
|
||||||
cd examples
|
|
||||||
cd AsyncDemo
|
|
||||||
touch .esp32.test.skip
|
|
||||||
touch .esp8266.test.skip
|
|
||||||
|
|
||||||
- name: Test Sync Demo
|
|
||||||
run: python3 ci/build_platform.py esp8266 esp32 picow_rp2040
|
|
Binary file not shown.
Before Width: | Height: | Size: 2 MiB |
Binary file not shown.
Before Width: | Height: | Size: 66 KiB |
|
@ -1,31 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
viewBox="0 0 254 83" style="enable-background:new 0 0 254 83;" xml:space="preserve">
|
|
||||||
<style type="text/css">
|
|
||||||
.st0{fill:#2E3034;}
|
|
||||||
.st1{fill:#488EFF;}
|
|
||||||
</style>
|
|
||||||
<g id="_x30_b742467-27ea-ae3f-7cfa-ca0e10ac04e7" transform="matrix(2.2,0,0,2.2,103.8876416683197,132.35599603652955)">
|
|
||||||
<path class="st0" d="M-6.1-45.4v-1H-13v9.3h6.8v-1h-5.8v-3.1h5.2v-1h-5.2v-3.1H-6.1z M-3.6-47h-1.1v9.8h1.1V-47z M1.3-38
|
|
||||||
c-1.4,0-2.3-1-2.5-2.2h5.9v-0.4c0-2-1.3-3.6-3.5-3.6s-3.5,1.6-3.5,3.6S-0.8-37,1.3-37C3-37,4-37.9,4.5-39.2H3.3
|
|
||||||
C3-38.5,2.3-38,1.3-38z M1.2-43.3c1.3,0,2.2,0.9,2.4,2.1h-4.8C-0.9-42.4-0.1-43.3,1.2-43.3z M11.5-44.2v1.1
|
|
||||||
c-0.5-0.8-1.3-1.2-2.5-1.2c-2,0-3.4,1.6-3.4,3.6c0,2,1.3,3.6,3.4,3.6c1.2,0,2-0.5,2.5-1.3v1c0,1.4-0.7,2.2-2.3,2.2
|
|
||||||
c-1.1,0-1.8-0.4-2-1.1H5.9c0.4,1.2,1.5,2,3.3,2c2.1,0,3.3-1.1,3.3-3.1v-6.8H11.5z M9.1-38.1c-1.6,0-2.5-1.2-2.5-2.6
|
|
||||||
c0-1.4,0.9-2.6,2.5-2.6c1.5,0,2.4,1.2,2.4,2.6C11.5-39.3,10.6-38.1,9.1-38.1z M17.3-44.3c-2,0-3.4,1.6-3.4,3.6s1.3,3.6,3.4,3.6
|
|
||||||
c1.2,0,2-0.5,2.5-1.2v1.1h1v-7h-1v1.1C19.3-43.8,18.4-44.3,17.3-44.3z M17.4-38c-1.6,0-2.5-1.2-2.5-2.7c0-1.4,0.9-2.7,2.5-2.7
|
|
||||||
c1.6,0,2.4,1.2,2.4,2.7C19.8-39.2,19-38,17.4-38z M22.7-44.2v7h1v-4c0-1.3,1-2.1,2.1-2.1c1.2,0,2,0.8,2,2.1v4h1v-4.1
|
|
||||||
c0-2-1.3-3-2.8-3c-1.1,0-1.8,0.5-2.3,1.2v-1.1H22.7z M32.2-37.2v-6.1h1.6v-0.9h-1.6v-2.5h-1.1v2.5h-1.4v0.9h1.4v6.1H32.2z
|
|
||||||
M39.3-46.5c-2.8,0-4.7,2.1-4.7,4.8c0,2.6,1.9,4.7,4.7,4.7s4.7-2.1,4.7-4.7C44-44.4,42.1-46.5,39.3-46.5z M39.3-38.1
|
|
||||||
c-2.3,0-3.7-1.6-3.7-3.7c0-2.1,1.4-3.7,3.7-3.7s3.7,1.6,3.7,3.7C43-39.7,41.6-38.1,39.3-38.1z M51.9-46.4h-7.5v1h3.2v8.3h1v-8.3
|
|
||||||
h3.2V-46.4z M56.5-46.4h-1.3l-3.9,9.3h1.2l1.1-2.7h4.6l1.1,2.7h1.2L56.5-46.4z M54-40.8l1.9-4.5l1.9,4.5H54z"/>
|
|
||||||
</g>
|
|
||||||
<g id="dc688d1f-a066-b7e7-8abc-115fa40e9445" transform="matrix(0.22552057488297111,0,0,0.22552057488297111,34.522743981666856,117.0177449672735)">
|
|
||||||
<path class="st1" d="M119-347.6c5.7,0,7.8,6.6,4.5,10.8c-7.2,8.4-14.4,16.5-21.6,24.9c-2.1,2.4-6.6,2.4-9,0
|
|
||||||
c-7.2-8.4-14.4-16.5-21.6-24.9c-4.5-5.1,1.2-12.3,6.3-10.8h13.2c-7.2-28.8-29.1-52.5-58.8-59.1c-5.7-1.2-11.4-1.8-17.1-1.8
|
|
||||||
c-28.8,0-55.5,15.9-69.6,42c-3.9,7.2-14.7,0.9-10.8-6.3c19.2-34.8,59.4-54.9,98.7-46.2c35.4,7.5,63,36,70.2,71.4
|
|
||||||
C103.4-347.6,119-347.6,119-347.6z M-83.2-309.2c-5.7,0-7.8-6.6-4.5-10.8c7.2-8.4,14.4-16.5,21.6-24.9c2.1-2.4,6.6-2.4,9,0
|
|
||||||
c7.2,8.4,14.4,16.5,21.6,24.9c4.5,5.1-1.2,12.3-6.3,10.8H-55c7.2,28.8,29.1,52.5,58.8,59.1c5.7,1.2,11.4,1.8,17.1,1.8
|
|
||||||
c28.8,0,55.5-15.9,69.6-42c3.9-7.2,14.7-0.9,10.8,6.3c-19.2,35.1-59.4,55.2-98.7,46.5c-35.4-7.8-63.3-36.3-70.5-71.7H-83.2z"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 79 KiB |
|
@ -1,100 +0,0 @@
|
||||||
/*
|
|
||||||
-----------------------
|
|
||||||
ElegantOTA - Async Demo Example
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
NOTE: Make sure you have enabled Async Mode in ElegantOTA before compiling this example!
|
|
||||||
Guide: https://docs.elegantota.pro/async-mode/
|
|
||||||
|
|
||||||
Skill Level: Beginner
|
|
||||||
|
|
||||||
This example provides with a bare minimal app with ElegantOTA functionality which works
|
|
||||||
with AsyncWebServer.
|
|
||||||
|
|
||||||
Github: https://github.com/ayushsharma82/ElegantOTA
|
|
||||||
WiKi: https://docs.elegantota.pro
|
|
||||||
|
|
||||||
Works with both ESP8266 & ESP32
|
|
||||||
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
Upgrade to ElegantOTA Pro: https://elegantota.pro
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(ESP8266)
|
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <ESPAsyncTCP.h>
|
|
||||||
#elif defined(ESP32)
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <AsyncTCP.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
|
||||||
#include <ElegantOTA.h>
|
|
||||||
|
|
||||||
const char* ssid = "........";
|
|
||||||
const char* password = "........";
|
|
||||||
|
|
||||||
AsyncWebServer server(80);
|
|
||||||
|
|
||||||
unsigned long ota_progress_millis = 0;
|
|
||||||
|
|
||||||
void onOTAStart() {
|
|
||||||
// Log when OTA has started
|
|
||||||
Serial.println("OTA update started!");
|
|
||||||
// <Add your own code here>
|
|
||||||
}
|
|
||||||
|
|
||||||
void onOTAProgress(size_t current, size_t final) {
|
|
||||||
// Log every 1 second
|
|
||||||
if (millis() - ota_progress_millis > 1000) {
|
|
||||||
ota_progress_millis = millis();
|
|
||||||
Serial.printf("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onOTAEnd(bool success) {
|
|
||||||
// Log when OTA has finished
|
|
||||||
if (success) {
|
|
||||||
Serial.println("OTA update finished successfully!");
|
|
||||||
} else {
|
|
||||||
Serial.println("There was an error during OTA update!");
|
|
||||||
}
|
|
||||||
// <Add your own code here>
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup(void) {
|
|
||||||
Serial.begin(115200);
|
|
||||||
WiFi.mode(WIFI_STA);
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
Serial.println("");
|
|
||||||
|
|
||||||
// Wait for connection
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
|
||||||
delay(500);
|
|
||||||
Serial.print(".");
|
|
||||||
}
|
|
||||||
Serial.println("");
|
|
||||||
Serial.print("Connected to ");
|
|
||||||
Serial.println(ssid);
|
|
||||||
Serial.print("IP address: ");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
|
|
||||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
|
|
||||||
request->send(200, "text/plain", "Hi! This is ElegantOTA AsyncDemo.");
|
|
||||||
});
|
|
||||||
|
|
||||||
ElegantOTA.begin(&server); // Start ElegantOTA
|
|
||||||
// ElegantOTA callbacks
|
|
||||||
ElegantOTA.onStart(onOTAStart);
|
|
||||||
ElegantOTA.onProgress(onOTAProgress);
|
|
||||||
ElegantOTA.onEnd(onOTAEnd);
|
|
||||||
|
|
||||||
server.begin();
|
|
||||||
Serial.println("HTTP server started");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(void) {
|
|
||||||
ElegantOTA.loop();
|
|
||||||
}
|
|
|
@ -1,117 +0,0 @@
|
||||||
/*
|
|
||||||
-----------------------
|
|
||||||
ElegantOTA - Demo Example
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
Skill Level: Beginner
|
|
||||||
|
|
||||||
This example provides with a bare minimal app with ElegantOTA functionality.
|
|
||||||
|
|
||||||
Github: https://github.com/ayushsharma82/ElegantOTA
|
|
||||||
WiKi: https://docs.elegantota.pro
|
|
||||||
|
|
||||||
Works with following hardware:
|
|
||||||
- ESP8266
|
|
||||||
- ESP32
|
|
||||||
- RP2040 (with WiFi) (Example: Raspberry Pi Pico W)
|
|
||||||
|
|
||||||
|
|
||||||
Important note for RP2040 users:
|
|
||||||
- RP2040 requires LittleFS partition for the OTA updates to work. Without LittleFS partition, OTA updates will fail.
|
|
||||||
Make sure to select Tools > Flash Size > "2MB (Sketch 1MB, FS 1MB)" option.
|
|
||||||
- If using bare RP2040, it requires WiFi module like Pico W for ElegantOTA to work.
|
|
||||||
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
Upgrade to ElegantOTA Pro: https://elegantota.pro
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(ESP8266)
|
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <WiFiClient.h>
|
|
||||||
#include <ESP8266WebServer.h>
|
|
||||||
#elif defined(ESP32)
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <WiFiClient.h>
|
|
||||||
#include <WebServer.h>
|
|
||||||
#elif defined(TARGET_RP2040)
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <WebServer.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ElegantOTA.h>
|
|
||||||
|
|
||||||
const char* ssid = "";
|
|
||||||
const char* password = "";
|
|
||||||
|
|
||||||
#if defined(ESP8266)
|
|
||||||
ESP8266WebServer server(80);
|
|
||||||
#elif defined(ESP32)
|
|
||||||
WebServer server(80);
|
|
||||||
#elif defined(TARGET_RP2040)
|
|
||||||
WebServer server(80);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned long ota_progress_millis = 0;
|
|
||||||
|
|
||||||
void onOTAStart() {
|
|
||||||
// Log when OTA has started
|
|
||||||
Serial.println("OTA update started!");
|
|
||||||
// <Add your own code here>
|
|
||||||
}
|
|
||||||
|
|
||||||
void onOTAProgress(size_t current, size_t final) {
|
|
||||||
// Log every 1 second
|
|
||||||
if (millis() - ota_progress_millis > 1000) {
|
|
||||||
ota_progress_millis = millis();
|
|
||||||
Serial.printf("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onOTAEnd(bool success) {
|
|
||||||
// Log when OTA has finished
|
|
||||||
if (success) {
|
|
||||||
Serial.println("OTA update finished successfully!");
|
|
||||||
} else {
|
|
||||||
Serial.println("There was an error during OTA update!");
|
|
||||||
}
|
|
||||||
// <Add your own code here>
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup(void) {
|
|
||||||
Serial.begin(115200);
|
|
||||||
WiFi.mode(WIFI_STA);
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
Serial.println("");
|
|
||||||
|
|
||||||
// Wait for connection
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
|
||||||
delay(500);
|
|
||||||
Serial.print(".");
|
|
||||||
}
|
|
||||||
Serial.println("");
|
|
||||||
Serial.print("Connected to ");
|
|
||||||
Serial.println(ssid);
|
|
||||||
Serial.print("IP address: ");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
|
|
||||||
server.on("/", []() {
|
|
||||||
server.send(200, "text/plain", "Hi! This is ElegantOTA Demo.");
|
|
||||||
});
|
|
||||||
|
|
||||||
ElegantOTA.begin(&server); // Start ElegantOTA
|
|
||||||
// ElegantOTA callbacks
|
|
||||||
ElegantOTA.onStart(onOTAStart);
|
|
||||||
ElegantOTA.onProgress(onOTAProgress);
|
|
||||||
ElegantOTA.onEnd(onOTAEnd);
|
|
||||||
|
|
||||||
server.begin();
|
|
||||||
Serial.println("HTTP server started");
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(void) {
|
|
||||||
server.handleClient();
|
|
||||||
ElegantOTA.loop();
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32"
|
|
||||||
if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
|
|
||||||
echo "Installing ESP32 Arduino Core ..."
|
|
||||||
script_init_path="$PWD"
|
|
||||||
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif"
|
|
||||||
cd "$ARDUINO_USR_PATH/hardware/espressif"
|
|
||||||
|
|
||||||
echo "Installing Python Serial ..."
|
|
||||||
pip install pyserial > /dev/null
|
|
||||||
|
|
||||||
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
|
||||||
echo "Installing Python Requests ..."
|
|
||||||
pip install requests > /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
|
|
||||||
echo "Linking Core..."
|
|
||||||
ln -s $GITHUB_WORKSPACE esp32
|
|
||||||
else
|
|
||||||
echo "Cloning Core Repository..."
|
|
||||||
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Updating Submodules ..."
|
|
||||||
cd esp32
|
|
||||||
git submodule update --init --recursive > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Installing Platform Tools ..."
|
|
||||||
cd tools && python get.py
|
|
||||||
cd $script_init_path
|
|
||||||
|
|
||||||
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
|
|
||||||
echo ""
|
|
||||||
fi
|
|
|
@ -1,220 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#OSTYPE: 'linux-gnu', ARCH: 'x86_64' => linux64
|
|
||||||
#OSTYPE: 'msys', ARCH: 'x86_64' => win32
|
|
||||||
#OSTYPE: 'darwin18', ARCH: 'i386' => macos
|
|
||||||
|
|
||||||
OSBITS=`arch`
|
|
||||||
if [[ "$OSTYPE" == "linux"* ]]; then
|
|
||||||
export OS_IS_LINUX="1"
|
|
||||||
ARCHIVE_FORMAT="tar.xz"
|
|
||||||
if [[ "$OSBITS" == "i686" ]]; then
|
|
||||||
OS_NAME="linux32"
|
|
||||||
elif [[ "$OSBITS" == "x86_64" ]]; then
|
|
||||||
OS_NAME="linux64"
|
|
||||||
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then
|
|
||||||
OS_NAME="linuxarm"
|
|
||||||
else
|
|
||||||
OS_NAME="$OSTYPE-$OSBITS"
|
|
||||||
echo "Unknown OS '$OS_NAME'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
export OS_IS_MACOS="1"
|
|
||||||
ARCHIVE_FORMAT="zip"
|
|
||||||
OS_NAME="macosx"
|
|
||||||
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
|
|
||||||
export OS_IS_WINDOWS="1"
|
|
||||||
ARCHIVE_FORMAT="zip"
|
|
||||||
OS_NAME="windows"
|
|
||||||
else
|
|
||||||
OS_NAME="$OSTYPE-$OSBITS"
|
|
||||||
echo "Unknown OS '$OS_NAME'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export OS_NAME
|
|
||||||
|
|
||||||
ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
|
|
||||||
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
|
|
||||||
|
|
||||||
if [ "$OS_IS_MACOS" == "1" ]; then
|
|
||||||
export ARDUINO_IDE_PATH="/Applications/Arduino.app/Contents/Java"
|
|
||||||
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
|
|
||||||
elif [ "$OS_IS_WINDOWS" == "1" ]; then
|
|
||||||
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
|
|
||||||
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
|
|
||||||
else
|
|
||||||
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
|
|
||||||
export ARDUINO_USR_PATH="$HOME/Arduino"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
|
|
||||||
echo "Installing Arduino IDE on $OS_NAME ..."
|
|
||||||
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
|
|
||||||
if [ "$OS_IS_LINUX" == "1" ]; then
|
|
||||||
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
|
||||||
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
|
|
||||||
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
|
|
||||||
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
|
||||||
else
|
|
||||||
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
|
||||||
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
|
|
||||||
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
|
|
||||||
if [ "$OS_IS_MACOS" == "1" ]; then
|
|
||||||
mv "Arduino.app" "/Applications/Arduino.app"
|
|
||||||
else
|
|
||||||
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
rm -rf "arduino.$ARCHIVE_FORMAT"
|
|
||||||
|
|
||||||
mkdir -p "$ARDUINO_USR_PATH/libraries"
|
|
||||||
mkdir -p "$ARDUINO_USR_PATH/hardware"
|
|
||||||
|
|
||||||
echo "Arduino IDE Installed in '$ARDUINO_IDE_PATH'"
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
|
|
||||||
if [ "$#" -lt 2 ]; then
|
|
||||||
echo "ERROR: Illegal number of parameters"
|
|
||||||
echo "USAGE: build_sketch <fqbn> <path-to-ino> [extra-options]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local fqbn="$1"
|
|
||||||
local sketch="$2"
|
|
||||||
local xtra_opts="$3"
|
|
||||||
local win_opts=""
|
|
||||||
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
|
||||||
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
|
|
||||||
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
|
|
||||||
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Compiling '"$(basename "$sketch")"' ..."
|
|
||||||
mkdir -p "$ARDUINO_BUILD_DIR"
|
|
||||||
mkdir -p "$ARDUINO_CACHE_DIR"
|
|
||||||
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
|
|
||||||
-fqbn=$fqbn \
|
|
||||||
-warnings="all" \
|
|
||||||
-tools "$ARDUINO_IDE_PATH/tools-builder" \
|
|
||||||
-tools "$ARDUINO_IDE_PATH/tools" \
|
|
||||||
-built-in-libraries "$ARDUINO_IDE_PATH/libraries" \
|
|
||||||
-hardware "$ARDUINO_IDE_PATH/hardware" \
|
|
||||||
-hardware "$ARDUINO_USR_PATH/hardware" \
|
|
||||||
-libraries "$ARDUINO_USR_PATH/libraries" \
|
|
||||||
-build-cache "$ARDUINO_CACHE_DIR" \
|
|
||||||
-build-path "$ARDUINO_BUILD_DIR" \
|
|
||||||
$win_opts $xtra_opts "$sketch"
|
|
||||||
}
|
|
||||||
|
|
||||||
function count_sketches() # count_sketches <examples-path>
|
|
||||||
{
|
|
||||||
local examples="$1"
|
|
||||||
rm -rf sketches.txt
|
|
||||||
if [ ! -d "$examples" ]; then
|
|
||||||
touch sketches.txt
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
local sketches=$(find $examples -name *.ino)
|
|
||||||
local sketchnum=0
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
|
||||||
continue
|
|
||||||
fi;
|
|
||||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo $sketch >> sketches.txt
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
done
|
|
||||||
return $sketchnum
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total-chunks> [extra-options]
|
|
||||||
{
|
|
||||||
local fqbn=$1
|
|
||||||
local examples=$2
|
|
||||||
local chunk_idex=$3
|
|
||||||
local chunks_num=$4
|
|
||||||
local xtra_opts=$5
|
|
||||||
|
|
||||||
if [ "$#" -lt 2 ]; then
|
|
||||||
echo "ERROR: Illegal number of parameters"
|
|
||||||
echo "USAGE: build_sketches <fqbn> <examples-path> [<chunk> <total-chunks>] [extra-options]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$#" -lt 4 ]; then
|
|
||||||
chunk_idex="0"
|
|
||||||
chunks_num="1"
|
|
||||||
xtra_opts=$3
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$chunks_num" -le 0 ]; then
|
|
||||||
echo "ERROR: Chunks count must be positive number"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ "$chunk_idex" -ge "$chunks_num" ]; then
|
|
||||||
echo "ERROR: Chunk index must be less than chunks count"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set +e
|
|
||||||
count_sketches "$examples"
|
|
||||||
local sketchcount=$?
|
|
||||||
set -e
|
|
||||||
local sketches=$(cat sketches.txt)
|
|
||||||
rm -rf sketches.txt
|
|
||||||
|
|
||||||
local chunk_size=$(( $sketchcount / $chunks_num ))
|
|
||||||
local all_chunks=$(( $chunks_num * $chunk_size ))
|
|
||||||
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
|
||||||
chunk_size=$(( $chunk_size + 1 ))
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_index=$(( $chunk_idex * $chunk_size ))
|
|
||||||
if [ "$sketchcount" -le "$start_index" ]; then
|
|
||||||
echo "Skipping job"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
|
||||||
if [ "$end_index" -gt "$sketchcount" ]; then
|
|
||||||
end_index=$sketchcount
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_num=$(( $start_index + 1 ))
|
|
||||||
echo "Found $sketchcount Sketches";
|
|
||||||
echo "Chunk Count : $chunks_num"
|
|
||||||
echo "Chunk Size : $chunk_size"
|
|
||||||
echo "Start Sketch: $start_num"
|
|
||||||
echo "End Sketch : $end_index"
|
|
||||||
|
|
||||||
local sketchnum=0
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|
|
||||||
|| [ -f "$sketchdir/.test.skip" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
if [ "$sketchnum" -le "$start_index" ] \
|
|
||||||
|| [ "$sketchnum" -gt "$end_index" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
build_sketch "$fqbn" "$sketch" "$xtra_opts"
|
|
||||||
local result=$?
|
|
||||||
if [ $result -ne 0 ]; then
|
|
||||||
return $result
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -1,133 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "Installing Python Wheel ..."
|
|
||||||
pip install wheel > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Installing PlatformIO ..."
|
|
||||||
pip install -U platformio > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "PlatformIO has been installed"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
|
|
||||||
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
|
|
||||||
if [ "$#" -lt 2 ]; then
|
|
||||||
echo "ERROR: Illegal number of parameters"
|
|
||||||
echo "USAGE: build_pio_sketch <board> <path-to-ino>"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local board="$1"
|
|
||||||
local sketch="$2"
|
|
||||||
local sketch_dir=$(dirname "$sketch")
|
|
||||||
echo ""
|
|
||||||
echo "Compiling '"$(basename "$sketch")"' ..."
|
|
||||||
python -m platformio ci -l '.' --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
|
|
||||||
}
|
|
||||||
|
|
||||||
function count_sketches() # count_sketches <examples-path>
|
|
||||||
{
|
|
||||||
local examples="$1"
|
|
||||||
rm -rf sketches.txt
|
|
||||||
if [ ! -d "$examples" ]; then
|
|
||||||
touch sketches.txt
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
local sketches=$(find $examples -name *.ino)
|
|
||||||
local sketchnum=0
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
|
||||||
continue
|
|
||||||
fi;
|
|
||||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo $sketch >> sketches.txt
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
done
|
|
||||||
return $sketchnum
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chunk> <total-chunks>
|
|
||||||
{
|
|
||||||
if [ "$#" -lt 2 ]; then
|
|
||||||
echo "ERROR: Illegal number of parameters"
|
|
||||||
echo "USAGE: build_pio_sketches <board> <examples-path> [<chunk> <total-chunks>]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local board=$1
|
|
||||||
local examples=$2
|
|
||||||
local chunk_idex=$3
|
|
||||||
local chunks_num=$4
|
|
||||||
|
|
||||||
if [ "$#" -lt 4 ]; then
|
|
||||||
chunk_idex="0"
|
|
||||||
chunks_num="1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$chunks_num" -le 0 ]; then
|
|
||||||
echo "ERROR: Chunks count must be positive number"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ "$chunk_idex" -ge "$chunks_num" ]; then
|
|
||||||
echo "ERROR: Chunk index must be less than chunks count"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set +e
|
|
||||||
count_sketches "$examples"
|
|
||||||
local sketchcount=$?
|
|
||||||
set -e
|
|
||||||
local sketches=$(cat sketches.txt)
|
|
||||||
rm -rf sketches.txt
|
|
||||||
|
|
||||||
local chunk_size=$(( $sketchcount / $chunks_num ))
|
|
||||||
local all_chunks=$(( $chunks_num * $chunk_size ))
|
|
||||||
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
|
||||||
chunk_size=$(( $chunk_size + 1 ))
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_index=$(( $chunk_idex * $chunk_size ))
|
|
||||||
if [ "$sketchcount" -le "$start_index" ]; then
|
|
||||||
echo "Skipping job"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
|
||||||
if [ "$end_index" -gt "$sketchcount" ]; then
|
|
||||||
end_index=$sketchcount
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_num=$(( $start_index + 1 ))
|
|
||||||
echo "Found $sketchcount Sketches";
|
|
||||||
echo "Chunk Count : $chunks_num"
|
|
||||||
echo "Chunk Size : $chunk_size"
|
|
||||||
echo "Start Sketch: $start_num"
|
|
||||||
echo "End Sketch : $end_index"
|
|
||||||
|
|
||||||
local sketchnum=0
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|
|
||||||
|| [ -f "$sketchdir/.test.skip" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
if [ "$sketchnum" -le "$start_index" ] \
|
|
||||||
|| [ "$sketchnum" -gt "$end_index" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
build_pio_sketch "$board" "$sketch"
|
|
||||||
local result=$?
|
|
||||||
if [ $result -ne 0 ]; then
|
|
||||||
return $result
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ ! -z "$TRAVIS_BUILD_DIR" ]; then
|
|
||||||
export GITHUB_WORKSPACE="$TRAVIS_BUILD_DIR"
|
|
||||||
export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG"
|
|
||||||
elif [ -z "$GITHUB_WORKSPACE" ]; then
|
|
||||||
export GITHUB_WORKSPACE="$PWD"
|
|
||||||
export GITHUB_REPOSITORY="me-no-dev/AsyncTCP"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CHUNK_INDEX=$1
|
|
||||||
CHUNKS_CNT=$2
|
|
||||||
BUILD_PIO=0
|
|
||||||
if [ "$#" -lt 2 ] || [ "$CHUNKS_CNT" -le 0 ]; then
|
|
||||||
CHUNK_INDEX=0
|
|
||||||
CHUNKS_CNT=1
|
|
||||||
elif [ "$CHUNK_INDEX" -gt "$CHUNKS_CNT" ]; then
|
|
||||||
CHUNK_INDEX=$CHUNKS_CNT
|
|
||||||
elif [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
|
|
||||||
BUILD_PIO=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$BUILD_PIO" -eq 0 ]; then
|
|
||||||
# ArduinoIDE Test
|
|
||||||
source ./.github/scripts/install-arduino-ide.sh
|
|
||||||
source ./.github/scripts/install-arduino-core-esp32.sh
|
|
||||||
|
|
||||||
echo "Installing AsyncTCP ..."
|
|
||||||
cp -rf "$GITHUB_WORKSPACE" "$ARDUINO_USR_PATH/libraries/AsyncTCP"
|
|
||||||
|
|
||||||
FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
|
|
||||||
build_sketches "$FQBN" "$GITHUB_WORKSPACE/examples"
|
|
||||||
if [ ! "$OS_IS_WINDOWS" == "1" ]; then
|
|
||||||
echo "Installing ESPAsyncWebServer ..."
|
|
||||||
git clone https://github.com/me-no-dev/ESPAsyncWebServer "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer" > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Installing ArduinoJson ..."
|
|
||||||
git clone https://github.com/bblanchon/ArduinoJson "$ARDUINO_USR_PATH/libraries/ArduinoJson" > /dev/null 2>&1
|
|
||||||
|
|
||||||
build_sketches "$FQBN" "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer/examples"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# PlatformIO Test
|
|
||||||
source ./.github/scripts/install-platformio.sh
|
|
||||||
|
|
||||||
echo "Installing AsyncTCP ..."
|
|
||||||
python -m platformio lib --storage-dir "$GITHUB_WORKSPACE" install
|
|
||||||
|
|
||||||
BOARD="esp32dev"
|
|
||||||
build_pio_sketches "$BOARD" "$GITHUB_WORKSPACE/examples"
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" != "cygwin" ]] && [[ "$OSTYPE" != "msys" ]] && [[ "$OSTYPE" != "win32" ]]; then
|
|
||||||
echo "Installing ESPAsyncWebServer ..."
|
|
||||||
python -m platformio lib -g install https://github.com/me-no-dev/ESPAsyncWebServer.git > /dev/null 2>&1
|
|
||||||
git clone https://github.com/me-no-dev/ESPAsyncWebServer "$HOME/ESPAsyncWebServer" > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Installing ArduinoJson ..."
|
|
||||||
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git > /dev/null 2>&1
|
|
||||||
|
|
||||||
build_pio_sketches "$BOARD" "$HOME/ESPAsyncWebServer/examples"
|
|
||||||
fi
|
|
||||||
fi
|
|
|
@ -1,31 +0,0 @@
|
||||||
# Configuration for probot-stale - https://github.com/probot/stale
|
|
||||||
|
|
||||||
daysUntilStale: 60
|
|
||||||
daysUntilClose: 14
|
|
||||||
limitPerRun: 30
|
|
||||||
staleLabel: stale
|
|
||||||
exemptLabels:
|
|
||||||
- pinned
|
|
||||||
- security
|
|
||||||
- "to be implemented"
|
|
||||||
- "for reference"
|
|
||||||
- "move to PR"
|
|
||||||
- "enhancement"
|
|
||||||
|
|
||||||
only: issues
|
|
||||||
onlyLabels: []
|
|
||||||
exemptProjects: false
|
|
||||||
exemptMilestones: false
|
|
||||||
exemptAssignees: false
|
|
||||||
|
|
||||||
markComment: >
|
|
||||||
[STALE_SET] This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed in 14 days if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
|
|
||||||
unmarkComment: >
|
|
||||||
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
|
|
||||||
|
|
||||||
closeComment: >
|
|
||||||
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
name: Async TCP CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- release/*
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build-arduino:
|
|
||||||
name: Arduino on ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macOS-latest]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Build Tests
|
|
||||||
run: bash ./.github/scripts/on-push.sh 0 1
|
|
||||||
|
|
||||||
build-pio:
|
|
||||||
name: PlatformIO on ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macOS-latest]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Build Tests
|
|
||||||
run: bash ./.github/scripts/on-push.sh 1 1
|
|
|
@ -1,36 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32"
|
|
||||||
if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
|
|
||||||
echo "Installing ESP32 Arduino Core ..."
|
|
||||||
script_init_path="$PWD"
|
|
||||||
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif"
|
|
||||||
cd "$ARDUINO_USR_PATH/hardware/espressif"
|
|
||||||
|
|
||||||
echo "Installing Python Serial ..."
|
|
||||||
pip install pyserial > /dev/null
|
|
||||||
|
|
||||||
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
|
||||||
echo "Installing Python Requests ..."
|
|
||||||
pip install requests > /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
|
|
||||||
echo "Linking Core..."
|
|
||||||
ln -s $GITHUB_WORKSPACE esp32
|
|
||||||
else
|
|
||||||
echo "Cloning Core Repository..."
|
|
||||||
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Updating Submodules ..."
|
|
||||||
cd esp32
|
|
||||||
git submodule update --init --recursive > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Installing Platform Tools ..."
|
|
||||||
cd tools && python get.py
|
|
||||||
cd $script_init_path
|
|
||||||
|
|
||||||
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
|
|
||||||
echo ""
|
|
||||||
fi
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "Installing ESP8266 Arduino Core ..."
|
|
||||||
script_init_path="$PWD"
|
|
||||||
mkdir -p "$ARDUINO_USR_PATH/hardware/esp8266com"
|
|
||||||
cd "$ARDUINO_USR_PATH/hardware/esp8266com"
|
|
||||||
|
|
||||||
echo "Installing Python Serial ..."
|
|
||||||
pip install pyserial > /dev/null
|
|
||||||
|
|
||||||
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
|
||||||
echo "Installing Python Requests ..."
|
|
||||||
pip install requests > /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Cloning Core Repository ..."
|
|
||||||
git clone https://github.com/esp8266/Arduino.git esp8266 > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Updating submodules ..."
|
|
||||||
cd esp8266
|
|
||||||
git submodule update --init --recursive > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Installing Platform Tools ..."
|
|
||||||
cd tools
|
|
||||||
python get.py > /dev/null
|
|
||||||
cd $script_init_path
|
|
||||||
|
|
||||||
echo "ESP8266 Arduino has been installed in '$ARDUINO_USR_PATH/hardware/esp8266com'"
|
|
||||||
echo ""
|
|
|
@ -1,228 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#OSTYPE: 'linux-gnu', ARCH: 'x86_64' => linux64
|
|
||||||
#OSTYPE: 'msys', ARCH: 'x86_64' => win32
|
|
||||||
#OSTYPE: 'darwin18', ARCH: 'i386' => macos
|
|
||||||
|
|
||||||
OSBITS=`arch`
|
|
||||||
if [[ "$OSTYPE" == "linux"* ]]; then
|
|
||||||
export OS_IS_LINUX="1"
|
|
||||||
ARCHIVE_FORMAT="tar.xz"
|
|
||||||
if [[ "$OSBITS" == "i686" ]]; then
|
|
||||||
OS_NAME="linux32"
|
|
||||||
elif [[ "$OSBITS" == "x86_64" ]]; then
|
|
||||||
OS_NAME="linux64"
|
|
||||||
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then
|
|
||||||
OS_NAME="linuxarm"
|
|
||||||
else
|
|
||||||
OS_NAME="$OSTYPE-$OSBITS"
|
|
||||||
echo "Unknown OS '$OS_NAME'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
export OS_IS_MACOS="1"
|
|
||||||
ARCHIVE_FORMAT="zip"
|
|
||||||
OS_NAME="macosx"
|
|
||||||
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
|
|
||||||
export OS_IS_WINDOWS="1"
|
|
||||||
ARCHIVE_FORMAT="zip"
|
|
||||||
OS_NAME="windows"
|
|
||||||
else
|
|
||||||
OS_NAME="$OSTYPE-$OSBITS"
|
|
||||||
echo "Unknown OS '$OS_NAME'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export OS_NAME
|
|
||||||
|
|
||||||
ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
|
|
||||||
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
|
|
||||||
|
|
||||||
if [ "$OS_IS_MACOS" == "1" ]; then
|
|
||||||
export ARDUINO_IDE_PATH="/Applications/Arduino.app/Contents/Java"
|
|
||||||
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
|
|
||||||
elif [ "$OS_IS_WINDOWS" == "1" ]; then
|
|
||||||
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
|
|
||||||
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
|
|
||||||
else
|
|
||||||
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
|
|
||||||
export ARDUINO_USR_PATH="$HOME/Arduino"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
|
|
||||||
echo "Installing Arduino IDE on $OS_NAME ..."
|
|
||||||
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
|
|
||||||
if [ "$OS_IS_LINUX" == "1" ]; then
|
|
||||||
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
|
||||||
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
|
|
||||||
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
|
|
||||||
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
|
||||||
else
|
|
||||||
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
|
||||||
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
|
|
||||||
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
|
|
||||||
if [ "$OS_IS_MACOS" == "1" ]; then
|
|
||||||
mv "Arduino.app" "/Applications/Arduino.app"
|
|
||||||
else
|
|
||||||
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
rm -rf "arduino.$ARCHIVE_FORMAT"
|
|
||||||
|
|
||||||
mkdir -p "$ARDUINO_USR_PATH/libraries"
|
|
||||||
mkdir -p "$ARDUINO_USR_PATH/hardware"
|
|
||||||
|
|
||||||
echo "Arduino IDE Installed in '$ARDUINO_IDE_PATH'"
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
function build_sketch(){ # build_sketch <fqbn> <path-to-ino> <build-flags> [extra-options]
|
|
||||||
if [ "$#" -lt 2 ]; then
|
|
||||||
echo "ERROR: Illegal number of parameters"
|
|
||||||
echo "USAGE: build_sketch <fqbn> <path-to-ino> <build-flags> [extra-options]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local fqbn="$1"
|
|
||||||
local sketch="$2"
|
|
||||||
local build_flags="$3"
|
|
||||||
local xtra_opts="$4"
|
|
||||||
local win_opts=""
|
|
||||||
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
|
||||||
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
|
|
||||||
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
|
|
||||||
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Compiling '"$(basename "$sketch")"' ..."
|
|
||||||
mkdir -p "$ARDUINO_BUILD_DIR"
|
|
||||||
mkdir -p "$ARDUINO_CACHE_DIR"
|
|
||||||
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
|
|
||||||
-fqbn=$fqbn \
|
|
||||||
-warnings="all" \
|
|
||||||
-tools "$ARDUINO_IDE_PATH/tools-builder" \
|
|
||||||
-tools "$ARDUINO_IDE_PATH/tools" \
|
|
||||||
-built-in-libraries "$ARDUINO_IDE_PATH/libraries" \
|
|
||||||
-hardware "$ARDUINO_IDE_PATH/hardware" \
|
|
||||||
-hardware "$ARDUINO_USR_PATH/hardware" \
|
|
||||||
-libraries "$ARDUINO_USR_PATH/libraries" \
|
|
||||||
-build-cache "$ARDUINO_CACHE_DIR" \
|
|
||||||
-build-path "$ARDUINO_BUILD_DIR" \
|
|
||||||
-prefs=compiler.cpp.extra_flags="$build_flags" \
|
|
||||||
$win_opts $xtra_opts "$sketch"
|
|
||||||
}
|
|
||||||
|
|
||||||
function count_sketches() # count_sketches <examples-path>
|
|
||||||
{
|
|
||||||
local examples="$1"
|
|
||||||
rm -rf sketches.txt
|
|
||||||
if [ ! -d "$examples" ]; then
|
|
||||||
touch sketches.txt
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
local sketches=$(find $examples -name *.ino)
|
|
||||||
local sketchnum=0
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
|
||||||
continue
|
|
||||||
fi;
|
|
||||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo $sketch >> sketches.txt
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
done
|
|
||||||
return $sketchnum
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total-chunks> [extra-options]
|
|
||||||
{
|
|
||||||
local fqbn=$1
|
|
||||||
local examples=$2
|
|
||||||
local chunk_idex=$3
|
|
||||||
local chunks_num=$4
|
|
||||||
local xtra_opts=$5
|
|
||||||
|
|
||||||
if [ "$#" -lt 2 ]; then
|
|
||||||
echo "ERROR: Illegal number of parameters"
|
|
||||||
echo "USAGE: build_sketches <fqbn> <examples-path> [<chunk> <total-chunks>] [extra-options]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$#" -lt 4 ]; then
|
|
||||||
chunk_idex="0"
|
|
||||||
chunks_num="1"
|
|
||||||
xtra_opts=$3
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$chunks_num" -le 0 ]; then
|
|
||||||
echo "ERROR: Chunks count must be positive number"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ "$chunk_idex" -ge "$chunks_num" ]; then
|
|
||||||
echo "ERROR: Chunk index must be less than chunks count"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set +e
|
|
||||||
count_sketches "$examples"
|
|
||||||
local sketchcount=$?
|
|
||||||
set -e
|
|
||||||
local sketches=$(cat sketches.txt)
|
|
||||||
rm -rf sketches.txt
|
|
||||||
|
|
||||||
local chunk_size=$(( $sketchcount / $chunks_num ))
|
|
||||||
local all_chunks=$(( $chunks_num * $chunk_size ))
|
|
||||||
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
|
||||||
chunk_size=$(( $chunk_size + 1 ))
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_index=$(( $chunk_idex * $chunk_size ))
|
|
||||||
if [ "$sketchcount" -le "$start_index" ]; then
|
|
||||||
echo "Skipping job"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
|
||||||
if [ "$end_index" -gt "$sketchcount" ]; then
|
|
||||||
end_index=$sketchcount
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_num=$(( $start_index + 1 ))
|
|
||||||
echo "Found $sketchcount Sketches";
|
|
||||||
echo "Chunk Count : $chunks_num"
|
|
||||||
echo "Chunk Size : $chunk_size"
|
|
||||||
echo "Start Sketch: $start_num"
|
|
||||||
echo "End Sketch : $end_index"
|
|
||||||
|
|
||||||
local sketchnum=0
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|
|
||||||
|| [ -f "$sketchdir/.test.skip" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
if [ "$sketchnum" -le "$start_index" ] \
|
|
||||||
|| [ "$sketchnum" -gt "$end_index" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
local sketchBuildFlags=""
|
|
||||||
if [ -f "$sketchdir/.test.build_flags" ]; then
|
|
||||||
while read line; do
|
|
||||||
sketchBuildFlags="$sketchBuildFlags $line"
|
|
||||||
done < "$sketchdir/.test.build_flags"
|
|
||||||
fi
|
|
||||||
build_sketch "$fqbn" "$sketch" "$sketchBuildFlags" "$xtra_opts"
|
|
||||||
local result=$?
|
|
||||||
if [ $result -ne 0 ]; then
|
|
||||||
return $result
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -1,140 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "Installing Python Wheel ..."
|
|
||||||
pip install wheel > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Installing PlatformIO ..."
|
|
||||||
pip install -U platformio > /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "PlatformIO has been installed"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
|
|
||||||
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino> <build-flags>
|
|
||||||
if [ "$#" -lt 3 ]; then
|
|
||||||
echo "ERROR: Illegal number of parameters"
|
|
||||||
echo "USAGE: build_pio_sketch <board> <path-to-ino> <build-flags>"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local board="$1"
|
|
||||||
local sketch="$2"
|
|
||||||
local buildFlags="$3"
|
|
||||||
local sketch_dir=$(dirname "$sketch")
|
|
||||||
echo ""
|
|
||||||
echo "Compiling '"$(basename "$sketch")"' ..."
|
|
||||||
python -m platformio ci -l '.' --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv" --project-option="build_flags=$buildFlags"
|
|
||||||
}
|
|
||||||
|
|
||||||
function count_sketches() # count_sketches <examples-path>
|
|
||||||
{
|
|
||||||
local examples="$1"
|
|
||||||
rm -rf sketches.txt
|
|
||||||
if [ ! -d "$examples" ]; then
|
|
||||||
touch sketches.txt
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
local sketches=$(find $examples -name *.ino)
|
|
||||||
local sketchnum=0
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
|
||||||
continue
|
|
||||||
fi;
|
|
||||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo $sketch >> sketches.txt
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
done
|
|
||||||
return $sketchnum
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chunk> <total-chunks>
|
|
||||||
{
|
|
||||||
if [ "$#" -lt 2 ]; then
|
|
||||||
echo "ERROR: Illegal number of parameters"
|
|
||||||
echo "USAGE: build_pio_sketches <board> <examples-path> [<chunk> <total-chunks>]"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local board=$1
|
|
||||||
local examples=$2
|
|
||||||
local chunk_idex=$3
|
|
||||||
local chunks_num=$4
|
|
||||||
|
|
||||||
if [ "$#" -lt 4 ]; then
|
|
||||||
chunk_idex="0"
|
|
||||||
chunks_num="1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$chunks_num" -le 0 ]; then
|
|
||||||
echo "ERROR: Chunks count must be positive number"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ "$chunk_idex" -ge "$chunks_num" ]; then
|
|
||||||
echo "ERROR: Chunk index must be less than chunks count"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set +e
|
|
||||||
count_sketches "$examples"
|
|
||||||
local sketchcount=$?
|
|
||||||
set -e
|
|
||||||
local sketches=$(cat sketches.txt)
|
|
||||||
rm -rf sketches.txt
|
|
||||||
|
|
||||||
local chunk_size=$(( $sketchcount / $chunks_num ))
|
|
||||||
local all_chunks=$(( $chunks_num * $chunk_size ))
|
|
||||||
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
|
||||||
chunk_size=$(( $chunk_size + 1 ))
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_index=$(( $chunk_idex * $chunk_size ))
|
|
||||||
if [ "$sketchcount" -le "$start_index" ]; then
|
|
||||||
echo "Skipping job"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
|
||||||
if [ "$end_index" -gt "$sketchcount" ]; then
|
|
||||||
end_index=$sketchcount
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_num=$(( $start_index + 1 ))
|
|
||||||
echo "Found $sketchcount Sketches";
|
|
||||||
echo "Chunk Count : $chunks_num"
|
|
||||||
echo "Chunk Size : $chunk_size"
|
|
||||||
echo "Start Sketch: $start_num"
|
|
||||||
echo "End Sketch : $end_index"
|
|
||||||
|
|
||||||
local sketchnum=0
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|
|
||||||
|| [ -f "$sketchdir/.test.skip" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
local sketchBuildFlags=""
|
|
||||||
if [ -f "$sketchdir/.test.build_flags" ]; then
|
|
||||||
while read line; do
|
|
||||||
sketchBuildFlags="$sketchBuildFlags $line"
|
|
||||||
done < "$sketchdir/.test.build_flags"
|
|
||||||
fi
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
if [ "$sketchnum" -le "$start_index" ] \
|
|
||||||
|| [ "$sketchnum" -gt "$end_index" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
build_pio_sketch "$board" "$sketch" "$sketchBuildFlags"
|
|
||||||
local result=$?
|
|
||||||
if [ $result -ne 0 ]; then
|
|
||||||
return $result
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ ! -z "$TRAVIS_BUILD_DIR" ]; then
|
|
||||||
export GITHUB_WORKSPACE="$TRAVIS_BUILD_DIR"
|
|
||||||
export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG"
|
|
||||||
elif [ -z "$GITHUB_WORKSPACE" ]; then
|
|
||||||
export GITHUB_WORKSPACE="$PWD"
|
|
||||||
export GITHUB_REPOSITORY="me-no-dev/ESPAsyncWebServer"
|
|
||||||
fi
|
|
||||||
|
|
||||||
TARGET_PLATFORM="$1"
|
|
||||||
CHUNK_INDEX=$2
|
|
||||||
CHUNKS_CNT=$3
|
|
||||||
BUILD_PIO=0
|
|
||||||
if [ "$#" -lt 1 ]; then
|
|
||||||
TARGET_PLATFORM="esp32"
|
|
||||||
fi
|
|
||||||
if [ "$#" -lt 3 ] || [ "$CHUNKS_CNT" -le 0 ]; then
|
|
||||||
CHUNK_INDEX=0
|
|
||||||
CHUNKS_CNT=1
|
|
||||||
elif [ "$CHUNK_INDEX" -gt "$CHUNKS_CNT" ]; then
|
|
||||||
CHUNK_INDEX=$CHUNKS_CNT
|
|
||||||
elif [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
|
|
||||||
BUILD_PIO=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$BUILD_PIO" -eq 0 ]; then
|
|
||||||
# ArduinoIDE Test
|
|
||||||
source ./.github/scripts/install-arduino-ide.sh
|
|
||||||
|
|
||||||
echo "Installing ESPAsyncWebServer ..."
|
|
||||||
cp -rf "$GITHUB_WORKSPACE" "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer"
|
|
||||||
echo "Installing ArduinoJson ..."
|
|
||||||
git clone https://github.com/bblanchon/ArduinoJson "$ARDUINO_USR_PATH/libraries/ArduinoJson" > /dev/null 2>&1
|
|
||||||
|
|
||||||
if [[ "$TARGET_PLATFORM" == "esp32" ]]; then
|
|
||||||
echo "Installing AsyncTCP ..."
|
|
||||||
git clone https://github.com/me-no-dev/AsyncTCP "$ARDUINO_USR_PATH/libraries/AsyncTCP" > /dev/null 2>&1
|
|
||||||
FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
|
|
||||||
source ./.github/scripts/install-arduino-core-esp32.sh
|
|
||||||
echo "BUILDING ESP32 EXAMPLES"
|
|
||||||
else
|
|
||||||
echo "Installing ESPAsyncTCP ..."
|
|
||||||
git clone https://github.com/me-no-dev/ESPAsyncTCP "$ARDUINO_USR_PATH/libraries/ESPAsyncTCP" > /dev/null 2>&1
|
|
||||||
FQBN="esp8266com:esp8266:generic:eesz=4M1M,ip=lm2f"
|
|
||||||
source ./.github/scripts/install-arduino-core-esp8266.sh
|
|
||||||
echo "BUILDING ESP8266 EXAMPLES"
|
|
||||||
fi
|
|
||||||
build_sketches "$FQBN" "$GITHUB_WORKSPACE/examples" "$CHUNK_INDEX" "$CHUNKS_CNT"
|
|
||||||
else
|
|
||||||
# PlatformIO Test
|
|
||||||
source ./.github/scripts/install-platformio.sh
|
|
||||||
|
|
||||||
python -m platformio lib --storage-dir "$GITHUB_WORKSPACE" install
|
|
||||||
echo "Installing ArduinoJson ..."
|
|
||||||
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git > /dev/null 2>&1
|
|
||||||
if [[ "$TARGET_PLATFORM" == "esp32" ]]; then
|
|
||||||
BOARD="esp32dev"
|
|
||||||
echo "Installing AsyncTCP ..."
|
|
||||||
python -m platformio lib -g install https://github.com/me-no-dev/AsyncTCP.git > /dev/null 2>&1
|
|
||||||
echo "BUILDING ESP32 EXAMPLES"
|
|
||||||
else
|
|
||||||
BOARD="esp12e"
|
|
||||||
echo "Installing ESPAsyncTCP ..."
|
|
||||||
python -m platformio lib -g install https://github.com/me-no-dev/ESPAsyncTCP.git > /dev/null 2>&1
|
|
||||||
echo "BUILDING ESP8266 EXAMPLES"
|
|
||||||
fi
|
|
||||||
build_pio_sketches "$BOARD" "$GITHUB_WORKSPACE/examples"
|
|
||||||
fi
|
|
|
@ -1,31 +0,0 @@
|
||||||
# Configuration for probot-stale - https://github.com/probot/stale
|
|
||||||
|
|
||||||
daysUntilStale: 60
|
|
||||||
daysUntilClose: 14
|
|
||||||
limitPerRun: 30
|
|
||||||
staleLabel: stale
|
|
||||||
exemptLabels:
|
|
||||||
- pinned
|
|
||||||
- security
|
|
||||||
- "to be implemented"
|
|
||||||
- "for reference"
|
|
||||||
- "move to PR"
|
|
||||||
- "enhancement"
|
|
||||||
|
|
||||||
only: issues
|
|
||||||
onlyLabels: []
|
|
||||||
exemptProjects: false
|
|
||||||
exemptMilestones: false
|
|
||||||
exemptAssignees: false
|
|
||||||
|
|
||||||
markComment: >
|
|
||||||
[STALE_SET] This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed in 14 days if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
|
|
||||||
unmarkComment: >
|
|
||||||
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
|
|
||||||
|
|
||||||
closeComment: >
|
|
||||||
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
name: ESP Async Web Server CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- release/*
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build-arduino:
|
|
||||||
name: Arduino for ${{ matrix.board }} on ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
||||||
board: [esp32, esp8266]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Build Tests
|
|
||||||
run: bash ./.github/scripts/on-push.sh ${{ matrix.board }} 0 1
|
|
||||||
|
|
||||||
# build-pio:
|
|
||||||
# name: PlatformIO for ${{ matrix.board }} on ${{ matrix.os }}
|
|
||||||
# runs-on: ${{ matrix.os }}
|
|
||||||
# strategy:
|
|
||||||
# matrix:
|
|
||||||
# os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
||||||
# board: [esp32, esp8266]
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v1
|
|
||||||
# - name: Build Tests
|
|
||||||
# run: bash ./.github/scripts/on-push.sh ${{ matrix.board }} 1 1
|
|
|
@ -1,47 +0,0 @@
|
||||||
#include <DNSServer.h>
|
|
||||||
#ifdef ESP32
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <AsyncTCP.h>
|
|
||||||
#elif defined(ESP8266)
|
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <ESPAsyncTCP.h>
|
|
||||||
#endif
|
|
||||||
#include "ESPAsyncWebServer.h"
|
|
||||||
|
|
||||||
DNSServer dnsServer;
|
|
||||||
AsyncWebServer server(80);
|
|
||||||
|
|
||||||
class CaptiveRequestHandler : public AsyncWebHandler {
|
|
||||||
public:
|
|
||||||
CaptiveRequestHandler() {}
|
|
||||||
virtual ~CaptiveRequestHandler() {}
|
|
||||||
|
|
||||||
bool canHandle(AsyncWebServerRequest *request){
|
|
||||||
//request->addInterestingHeader("ANY");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleRequest(AsyncWebServerRequest *request) {
|
|
||||||
AsyncResponseStream *response = request->beginResponseStream("text/html");
|
|
||||||
response->print("<!DOCTYPE html><html><head><title>Captive Portal</title></head><body>");
|
|
||||||
response->print("<p>This is out captive portal front page.</p>");
|
|
||||||
response->printf("<p>You were trying to reach: http://%s%s</p>", request->host().c_str(), request->url().c_str());
|
|
||||||
response->printf("<p>Try opening <a href='http://%s'>this link</a> instead</p>", WiFi.softAPIP().toString().c_str());
|
|
||||||
response->print("</body></html>");
|
|
||||||
request->send(response);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
//your other setup stuff...
|
|
||||||
WiFi.softAP("esp-captive");
|
|
||||||
dnsServer.start(53, "*", WiFi.softAPIP());
|
|
||||||
server.addHandler(new CaptiveRequestHandler()).setFilter(ON_AP_FILTER);//only when requested from AP
|
|
||||||
//more handlers...
|
|
||||||
server.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
dnsServer.processNextRequest();
|
|
||||||
}
|
|
|
@ -1,221 +0,0 @@
|
||||||
#include <ArduinoOTA.h>
|
|
||||||
#ifdef ESP32
|
|
||||||
#include <FS.h>
|
|
||||||
#include <SPIFFS.h>
|
|
||||||
#include <ESPmDNS.h>
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <AsyncTCP.h>
|
|
||||||
#elif defined(ESP8266)
|
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <ESPAsyncTCP.h>
|
|
||||||
#include <ESP8266mDNS.h>
|
|
||||||
#endif
|
|
||||||
#include <ESPAsyncWebServer.h>
|
|
||||||
#include <SPIFFSEditor.h>
|
|
||||||
|
|
||||||
// SKETCH BEGIN
|
|
||||||
AsyncWebServer server(80);
|
|
||||||
AsyncWebSocket ws("/ws");
|
|
||||||
AsyncEventSource events("/events");
|
|
||||||
|
|
||||||
void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len){
|
|
||||||
if(type == WS_EVT_CONNECT){
|
|
||||||
Serial.printf("ws[%s][%u] connect\n", server->url(), client->id());
|
|
||||||
client->printf("Hello Client %u :)", client->id());
|
|
||||||
client->ping();
|
|
||||||
} else if(type == WS_EVT_DISCONNECT){
|
|
||||||
Serial.printf("ws[%s][%u] disconnect\n", server->url(), client->id());
|
|
||||||
} else if(type == WS_EVT_ERROR){
|
|
||||||
Serial.printf("ws[%s][%u] error(%u): %s\n", server->url(), client->id(), *((uint16_t*)arg), (char*)data);
|
|
||||||
} else if(type == WS_EVT_PONG){
|
|
||||||
Serial.printf("ws[%s][%u] pong[%u]: %s\n", server->url(), client->id(), len, (len)?(char*)data:"");
|
|
||||||
} else if(type == WS_EVT_DATA){
|
|
||||||
AwsFrameInfo * info = (AwsFrameInfo*)arg;
|
|
||||||
String msg = "";
|
|
||||||
if(info->final && info->index == 0 && info->len == len){
|
|
||||||
//the whole message is in a single frame and we got all of it's data
|
|
||||||
Serial.printf("ws[%s][%u] %s-message[%llu]: ", server->url(), client->id(), (info->opcode == WS_TEXT)?"text":"binary", info->len);
|
|
||||||
|
|
||||||
if(info->opcode == WS_TEXT){
|
|
||||||
for(size_t i=0; i < info->len; i++) {
|
|
||||||
msg += (char) data[i];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
char buff[3];
|
|
||||||
for(size_t i=0; i < info->len; i++) {
|
|
||||||
sprintf(buff, "%02x ", (uint8_t) data[i]);
|
|
||||||
msg += buff ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Serial.printf("%s\n",msg.c_str());
|
|
||||||
|
|
||||||
if(info->opcode == WS_TEXT)
|
|
||||||
client->text("I got your text message");
|
|
||||||
else
|
|
||||||
client->binary("I got your binary message");
|
|
||||||
} else {
|
|
||||||
//message is comprised of multiple frames or the frame is split into multiple packets
|
|
||||||
if(info->index == 0){
|
|
||||||
if(info->num == 0)
|
|
||||||
Serial.printf("ws[%s][%u] %s-message start\n", server->url(), client->id(), (info->message_opcode == WS_TEXT)?"text":"binary");
|
|
||||||
Serial.printf("ws[%s][%u] frame[%u] start[%llu]\n", server->url(), client->id(), info->num, info->len);
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.printf("ws[%s][%u] frame[%u] %s[%llu - %llu]: ", server->url(), client->id(), info->num, (info->message_opcode == WS_TEXT)?"text":"binary", info->index, info->index + len);
|
|
||||||
|
|
||||||
if(info->opcode == WS_TEXT){
|
|
||||||
for(size_t i=0; i < len; i++) {
|
|
||||||
msg += (char) data[i];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
char buff[3];
|
|
||||||
for(size_t i=0; i < len; i++) {
|
|
||||||
sprintf(buff, "%02x ", (uint8_t) data[i]);
|
|
||||||
msg += buff ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Serial.printf("%s\n",msg.c_str());
|
|
||||||
|
|
||||||
if((info->index + len) == info->len){
|
|
||||||
Serial.printf("ws[%s][%u] frame[%u] end[%llu]\n", server->url(), client->id(), info->num, info->len);
|
|
||||||
if(info->final){
|
|
||||||
Serial.printf("ws[%s][%u] %s-message end\n", server->url(), client->id(), (info->message_opcode == WS_TEXT)?"text":"binary");
|
|
||||||
if(info->message_opcode == WS_TEXT)
|
|
||||||
client->text("I got your text message");
|
|
||||||
else
|
|
||||||
client->binary("I got your binary message");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char* ssid = "*******";
|
|
||||||
const char* password = "*******";
|
|
||||||
const char * hostName = "esp-async";
|
|
||||||
const char* http_username = "admin";
|
|
||||||
const char* http_password = "admin";
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(115200);
|
|
||||||
Serial.setDebugOutput(true);
|
|
||||||
WiFi.mode(WIFI_AP_STA);
|
|
||||||
WiFi.softAP(hostName);
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
|
|
||||||
Serial.printf("STA: Failed!\n");
|
|
||||||
WiFi.disconnect(false);
|
|
||||||
delay(1000);
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Send OTA events to the browser
|
|
||||||
ArduinoOTA.onStart([]() { events.send("Update Start", "ota"); });
|
|
||||||
ArduinoOTA.onEnd([]() { events.send("Update End", "ota"); });
|
|
||||||
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
|
||||||
char p[32];
|
|
||||||
sprintf(p, "Progress: %u%%\n", (progress/(total/100)));
|
|
||||||
events.send(p, "ota");
|
|
||||||
});
|
|
||||||
ArduinoOTA.onError([](ota_error_t error) {
|
|
||||||
if(error == OTA_AUTH_ERROR) events.send("Auth Failed", "ota");
|
|
||||||
else if(error == OTA_BEGIN_ERROR) events.send("Begin Failed", "ota");
|
|
||||||
else if(error == OTA_CONNECT_ERROR) events.send("Connect Failed", "ota");
|
|
||||||
else if(error == OTA_RECEIVE_ERROR) events.send("Recieve Failed", "ota");
|
|
||||||
else if(error == OTA_END_ERROR) events.send("End Failed", "ota");
|
|
||||||
});
|
|
||||||
ArduinoOTA.setHostname(hostName);
|
|
||||||
ArduinoOTA.begin();
|
|
||||||
|
|
||||||
MDNS.addService("http","tcp",80);
|
|
||||||
|
|
||||||
SPIFFS.begin();
|
|
||||||
|
|
||||||
ws.onEvent(onWsEvent);
|
|
||||||
server.addHandler(&ws);
|
|
||||||
|
|
||||||
events.onConnect([](AsyncEventSourceClient *client){
|
|
||||||
client->send("hello!",NULL,millis(),1000);
|
|
||||||
});
|
|
||||||
server.addHandler(&events);
|
|
||||||
|
|
||||||
#ifdef ESP32
|
|
||||||
server.addHandler(new SPIFFSEditor(SPIFFS, http_username,http_password));
|
|
||||||
#elif defined(ESP8266)
|
|
||||||
server.addHandler(new SPIFFSEditor(http_username,http_password));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
server.on("/heap", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
request->send(200, "text/plain", String(ESP.getFreeHeap()));
|
|
||||||
});
|
|
||||||
|
|
||||||
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.htm");
|
|
||||||
|
|
||||||
server.onNotFound([](AsyncWebServerRequest *request){
|
|
||||||
Serial.printf("NOT_FOUND: ");
|
|
||||||
if(request->method() == HTTP_GET)
|
|
||||||
Serial.printf("GET");
|
|
||||||
else if(request->method() == HTTP_POST)
|
|
||||||
Serial.printf("POST");
|
|
||||||
else if(request->method() == HTTP_DELETE)
|
|
||||||
Serial.printf("DELETE");
|
|
||||||
else if(request->method() == HTTP_PUT)
|
|
||||||
Serial.printf("PUT");
|
|
||||||
else if(request->method() == HTTP_PATCH)
|
|
||||||
Serial.printf("PATCH");
|
|
||||||
else if(request->method() == HTTP_HEAD)
|
|
||||||
Serial.printf("HEAD");
|
|
||||||
else if(request->method() == HTTP_OPTIONS)
|
|
||||||
Serial.printf("OPTIONS");
|
|
||||||
else
|
|
||||||
Serial.printf("UNKNOWN");
|
|
||||||
Serial.printf(" http://%s%s\n", request->host().c_str(), request->url().c_str());
|
|
||||||
|
|
||||||
if(request->contentLength()){
|
|
||||||
Serial.printf("_CONTENT_TYPE: %s\n", request->contentType().c_str());
|
|
||||||
Serial.printf("_CONTENT_LENGTH: %u\n", request->contentLength());
|
|
||||||
}
|
|
||||||
|
|
||||||
int headers = request->headers();
|
|
||||||
int i;
|
|
||||||
for(i=0;i<headers;i++){
|
|
||||||
AsyncWebHeader* h = request->getHeader(i);
|
|
||||||
Serial.printf("_HEADER[%s]: %s\n", h->name().c_str(), h->value().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
int params = request->params();
|
|
||||||
for(i=0;i<params;i++){
|
|
||||||
AsyncWebParameter* p = request->getParam(i);
|
|
||||||
if(p->isFile()){
|
|
||||||
Serial.printf("_FILE[%s]: %s, size: %u\n", p->name().c_str(), p->value().c_str(), p->size());
|
|
||||||
} else if(p->isPost()){
|
|
||||||
Serial.printf("_POST[%s]: %s\n", p->name().c_str(), p->value().c_str());
|
|
||||||
} else {
|
|
||||||
Serial.printf("_GET[%s]: %s\n", p->name().c_str(), p->value().c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
request->send(404);
|
|
||||||
});
|
|
||||||
server.onFileUpload([](AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool final){
|
|
||||||
if(!index)
|
|
||||||
Serial.printf("UploadStart: %s\n", filename.c_str());
|
|
||||||
Serial.printf("%s", (const char*)data);
|
|
||||||
if(final)
|
|
||||||
Serial.printf("UploadEnd: %s (%u)\n", filename.c_str(), index+len);
|
|
||||||
});
|
|
||||||
server.onRequestBody([](AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total){
|
|
||||||
if(!index)
|
|
||||||
Serial.printf("BodyStart: %u\n", total);
|
|
||||||
Serial.printf("%s", (const char*)data);
|
|
||||||
if(index + len == total)
|
|
||||||
Serial.printf("BodyEnd: %u\n", total);
|
|
||||||
});
|
|
||||||
server.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
ArduinoOTA.handle();
|
|
||||||
ws.cleanupClients();
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
/*.js.gz
|
|
||||||
/.exclude.files
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,131 +0,0 @@
|
||||||
<!--
|
|
||||||
FSWebServer - Example Index Page
|
|
||||||
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
|
|
||||||
This file is part of the ESP8266WebServer library for Arduino environment.
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
-->
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
|
||||||
<title>WebSocketTester</title>
|
|
||||||
<style type="text/css" media="screen">
|
|
||||||
body {
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
background-color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
#dbg, #input_div, #input_el {
|
|
||||||
font-family: monaco;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 13px;
|
|
||||||
color: #AAA;
|
|
||||||
}
|
|
||||||
|
|
||||||
#dbg, #input_div {
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
padding-left:4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#input_el {
|
|
||||||
width:98%;
|
|
||||||
background-color: rgba(0,0,0,0);
|
|
||||||
border: 0px;
|
|
||||||
}
|
|
||||||
#input_el:focus {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var ws = null;
|
|
||||||
function ge(s){ return document.getElementById(s);}
|
|
||||||
function ce(s){ return document.createElement(s);}
|
|
||||||
function stb(){ window.scrollTo(0, document.body.scrollHeight || document.documentElement.scrollHeight); }
|
|
||||||
function sendBlob(str){
|
|
||||||
var buf = new Uint8Array(str.length);
|
|
||||||
for (var i = 0; i < str.length; ++i) buf[i] = str.charCodeAt(i);
|
|
||||||
ws.send(buf);
|
|
||||||
}
|
|
||||||
function addMessage(m){
|
|
||||||
var msg = ce("div");
|
|
||||||
msg.innerText = m;
|
|
||||||
ge("dbg").appendChild(msg);
|
|
||||||
stb();
|
|
||||||
}
|
|
||||||
function startSocket(){
|
|
||||||
ws = new WebSocket('ws://'+document.location.host+'/ws',['arduino']);
|
|
||||||
ws.binaryType = "arraybuffer";
|
|
||||||
ws.onopen = function(e){
|
|
||||||
addMessage("Connected");
|
|
||||||
};
|
|
||||||
ws.onclose = function(e){
|
|
||||||
addMessage("Disconnected");
|
|
||||||
};
|
|
||||||
ws.onerror = function(e){
|
|
||||||
console.log("ws error", e);
|
|
||||||
addMessage("Error");
|
|
||||||
};
|
|
||||||
ws.onmessage = function(e){
|
|
||||||
var msg = "";
|
|
||||||
if(e.data instanceof ArrayBuffer){
|
|
||||||
msg = "BIN:";
|
|
||||||
var bytes = new Uint8Array(e.data);
|
|
||||||
for (var i = 0; i < bytes.length; i++) {
|
|
||||||
msg += String.fromCharCode(bytes[i]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
msg = "TXT:"+e.data;
|
|
||||||
}
|
|
||||||
addMessage(msg);
|
|
||||||
};
|
|
||||||
ge("input_el").onkeydown = function(e){
|
|
||||||
stb();
|
|
||||||
if(e.keyCode == 13 && ge("input_el").value != ""){
|
|
||||||
ws.send(ge("input_el").value);
|
|
||||||
ge("input_el").value = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function startEvents(){
|
|
||||||
var es = new EventSource('/events');
|
|
||||||
es.onopen = function(e) {
|
|
||||||
addMessage("Events Opened");
|
|
||||||
};
|
|
||||||
es.onerror = function(e) {
|
|
||||||
if (e.target.readyState != EventSource.OPEN) {
|
|
||||||
addMessage("Events Closed");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
es.onmessage = function(e) {
|
|
||||||
addMessage("Event: " + e.data);
|
|
||||||
};
|
|
||||||
es.addEventListener('ota', function(e) {
|
|
||||||
addMessage("Event[ota]: " + e.data);
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
function onBodyLoad(){
|
|
||||||
startSocket();
|
|
||||||
startEvents();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body id="body" onload="onBodyLoad()">
|
|
||||||
<pre id="dbg"></pre>
|
|
||||||
<div id="input_div">
|
|
||||||
$<input type="text" value="" id="input_el">
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +0,0 @@
|
||||||
-DASYNCWEBSERVER_REGEX=1
|
|
|
@ -1,77 +0,0 @@
|
||||||
//
|
|
||||||
// A simple server implementation with regex routes:
|
|
||||||
// * serve static messages
|
|
||||||
// * read GET and POST parameters
|
|
||||||
// * handle missing pages / 404s
|
|
||||||
//
|
|
||||||
|
|
||||||
// Add buildflag ASYNCWEBSERVER_REGEX to enable the regex support
|
|
||||||
|
|
||||||
// For platformio: platformio.ini:
|
|
||||||
// build_flags =
|
|
||||||
// -DASYNCWEBSERVER_REGEX
|
|
||||||
|
|
||||||
// For arduino IDE: create/update platform.local.txt
|
|
||||||
// Windows: C:\Users\(username)\AppData\Local\Arduino15\packages\espxxxx\hardware\espxxxx\{version}\platform.local.txt
|
|
||||||
// Linux: ~/.arduino15/packages/espxxxx/hardware/espxxxx/{version}/platform.local.txt
|
|
||||||
//
|
|
||||||
// compiler.cpp.extra_flags=-DASYNCWEBSERVER_REGEX=1
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#ifdef ESP32
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <AsyncTCP.h>
|
|
||||||
#elif defined(ESP8266)
|
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <ESPAsyncTCP.h>
|
|
||||||
#endif
|
|
||||||
#include <ESPAsyncWebServer.h>
|
|
||||||
|
|
||||||
AsyncWebServer server(80);
|
|
||||||
|
|
||||||
const char* ssid = "YOUR_SSID";
|
|
||||||
const char* password = "YOUR_PASSWORD";
|
|
||||||
|
|
||||||
const char* PARAM_MESSAGE = "message";
|
|
||||||
|
|
||||||
void notFound(AsyncWebServerRequest *request) {
|
|
||||||
request->send(404, "text/plain", "Not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
|
|
||||||
Serial.begin(115200);
|
|
||||||
WiFi.mode(WIFI_STA);
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
|
|
||||||
Serial.printf("WiFi Failed!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.print("IP Address: ");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
|
|
||||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
request->send(200, "text/plain", "Hello, world");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Send a GET request to <IP>/sensor/<number>
|
|
||||||
server.on("^\\/sensor\\/([0-9]+)$", HTTP_GET, [] (AsyncWebServerRequest *request) {
|
|
||||||
String sensorNumber = request->pathArg(0);
|
|
||||||
request->send(200, "text/plain", "Hello, sensor: " + sensorNumber);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Send a GET request to <IP>/sensor/<number>/action/<action>
|
|
||||||
server.on("^\\/sensor\\/([0-9]+)\\/action\\/([a-zA-Z0-9]+)$", HTTP_GET, [] (AsyncWebServerRequest *request) {
|
|
||||||
String sensorNumber = request->pathArg(0);
|
|
||||||
String action = request->pathArg(1);
|
|
||||||
request->send(200, "text/plain", "Hello, sensor: " + sensorNumber + ", with action: " + action);
|
|
||||||
});
|
|
||||||
|
|
||||||
server.onNotFound(notFound);
|
|
||||||
|
|
||||||
server.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
//
|
|
||||||
// A simple server implementation showing how to:
|
|
||||||
// * serve static messages
|
|
||||||
// * read GET and POST parameters
|
|
||||||
// * handle missing pages / 404s
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#ifdef ESP32
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <AsyncTCP.h>
|
|
||||||
#elif defined(ESP8266)
|
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <ESPAsyncTCP.h>
|
|
||||||
#endif
|
|
||||||
#include <ESPAsyncWebServer.h>
|
|
||||||
|
|
||||||
AsyncWebServer server(80);
|
|
||||||
|
|
||||||
const char* ssid = "YOUR_SSID";
|
|
||||||
const char* password = "YOUR_PASSWORD";
|
|
||||||
|
|
||||||
const char* PARAM_MESSAGE = "message";
|
|
||||||
|
|
||||||
void notFound(AsyncWebServerRequest *request) {
|
|
||||||
request->send(404, "text/plain", "Not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
|
|
||||||
Serial.begin(115200);
|
|
||||||
WiFi.mode(WIFI_STA);
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
|
|
||||||
Serial.printf("WiFi Failed!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.print("IP Address: ");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
|
|
||||||
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
|
|
||||||
request->send(200, "text/plain", "Hello, world");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Send a GET request to <IP>/get?message=<message>
|
|
||||||
server.on("/get", HTTP_GET, [] (AsyncWebServerRequest *request) {
|
|
||||||
String message;
|
|
||||||
if (request->hasParam(PARAM_MESSAGE)) {
|
|
||||||
message = request->getParam(PARAM_MESSAGE)->value();
|
|
||||||
} else {
|
|
||||||
message = "No message sent";
|
|
||||||
}
|
|
||||||
request->send(200, "text/plain", "Hello, GET: " + message);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Send a POST request to <IP>/post with a form field message set to <message>
|
|
||||||
server.on("/post", HTTP_POST, [](AsyncWebServerRequest *request){
|
|
||||||
String message;
|
|
||||||
if (request->hasParam(PARAM_MESSAGE, true)) {
|
|
||||||
message = request->getParam(PARAM_MESSAGE, true)->value();
|
|
||||||
} else {
|
|
||||||
message = "No message sent";
|
|
||||||
}
|
|
||||||
request->send(200, "text/plain", "Hello, POST: " + message);
|
|
||||||
});
|
|
||||||
|
|
||||||
server.onNotFound(notFound);
|
|
||||||
|
|
||||||
server.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
}
|
|
|
@ -12,7 +12,9 @@ int ESP32CAN::CANWriteFrame(const CAN_frame_t* p_frame) {
|
||||||
result = CAN_write_frame(p_frame);
|
result = CAN_write_frame(p_frame);
|
||||||
tx_ok = (result == 0) ? true : false;
|
tx_ok = (result == 0) ? true : false;
|
||||||
if (tx_ok == false) {
|
if (tx_ok == false) {
|
||||||
|
#ifdef DEBUG_VIA_USB
|
||||||
Serial.println("CAN failure! Check wires");
|
Serial.println("CAN failure! Check wires");
|
||||||
|
#endif
|
||||||
set_event(EVENT_CAN_TX_FAILURE, 0);
|
set_event(EVENT_CAN_TX_FAILURE, 0);
|
||||||
start_time = millis();
|
start_time = millis();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue