1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-06 14:46:50 +02:00

Use new EpoxyDuino version with patches

This commit is contained in:
Mitch Bradley
2021-12-12 14:00:06 -10:00
parent 868797b11d
commit 9bcb0479e1
24 changed files with 156 additions and 100 deletions

View File

@@ -1,7 +1,7 @@
#include "Grbl.h"
#include "Motors/Motor.h"
#include "Motors/TrinamicDriver.h" #include "Motors/TrinamicDriver.h"
#include "Motors/TrinamicUartDriver.h" #include "Motors/TrinamicUartDriver.h"
#include "Grbl.h"
#include "Motors/Motor.h"
#include "Motors/Dynamixel2.h" #include "Motors/Dynamixel2.h"
#include "Motors/Servo.h" #include "Motors/Servo.h"
#include "Motors/RcServo.h" #include "Motors/RcServo.h"
@@ -825,8 +825,6 @@ void dump_config() {
print_user_outputs(); print_user_outputs();
print_spindle_class(); print_spindle_class();
p("\n");
int db = 0; int db = 0;
#ifdef ENABLE_SOFTWARE_DEBOUNCE #ifdef ENABLE_SOFTWARE_DEBOUNCE
db = DEBOUNCE_PERIOD; db = DEBOUNCE_PERIOD;

View File

@@ -36,7 +36,7 @@ void grbl_init() {
#endif #endif
client_init(); // Setup serial baud rate and interrupts client_init(); // Setup serial baud rate and interrupts
display_init(); display_init();
#ifndef EMIT_YAML #ifndef NATIVE
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Grbl_ESP32 Ver %s Date %s", GRBL_VERSION, GRBL_VERSION_BUILD); // print grbl_esp32 verion info grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Grbl_ESP32 Ver %s Date %s", GRBL_VERSION, GRBL_VERSION_BUILD); // print grbl_esp32 verion info
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Compiled with ESP32 SDK:%s", ESP.getSdkVersion()); // print the SDK version grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Compiled with ESP32 SDK:%s", ESP.getSdkVersion()); // print the SDK version
// show the map name at startup // show the map name at startup

View File

@@ -961,8 +961,12 @@ int IRAM_ATTR i2s_out_init() {
return i2s_out_init(default_param); return i2s_out_init(default_param);
} }
#else #else
int i2s_out_init(i2s_out_init_t& init_param) {} int i2s_out_init(i2s_out_init_t& init_param) {
int i2s_out_init() {} return 0;
}
int i2s_out_init() {
return 0;
}
uint8_t i2s_out_read(uint8_t pin) { uint8_t i2s_out_read(uint8_t pin) {
return 0; return 0;
} }

View File

@@ -70,7 +70,7 @@ void grbl_sendf(uint8_t client, const char* format, ...) {
va_list copy; va_list copy;
va_start(arg, format); va_start(arg, format);
va_copy(copy, arg); va_copy(copy, arg);
size_t len = vsnprintf(NULL, 0, format, arg); size_t len = vsnprintf(NULL, 0, format, copy);
va_end(copy); va_end(copy);
if (len >= sizeof(loc_buf)) { if (len >= sizeof(loc_buf)) {
temp = new char[len + 1]; temp = new char[len + 1];

View File

@@ -41,7 +41,7 @@ static char comment[LINE_BUFFER_SIZE]; // Line to be executed. Z
void listDir(fs::FS& fs, const char* dirname, uint8_t levels, uint8_t client) { void listDir(fs::FS& fs, const char* dirname, uint8_t levels, uint8_t client) {
//char temp_filename[128]; // to help filter by extension TODO: 128 needs a definition based on something //char temp_filename[128]; // to help filter by extension TODO: 128 needs a definition based on something
File root = fs.open(dirname); File root = fs.open(dirname, "r");
if (!root) { if (!root) {
report_status_message(Error::FsFailedOpenDir, client); report_status_message(Error::FsFailedOpenDir, client);
return; return;
@@ -64,7 +64,7 @@ void listDir(fs::FS& fs, const char* dirname, uint8_t levels, uint8_t client) {
} }
boolean openFile(fs::FS& fs, const char* path) { boolean openFile(fs::FS& fs, const char* path) {
myFile = fs.open(path); myFile = fs.open(path, "r");
if (!myFile) { if (!myFile) {
//report_status_message(Error::FsFailedRead, CLIENT_SERIAL); //report_status_message(Error::FsFailedRead, CLIENT_SERIAL);
return false; return false;

View File

@@ -9,7 +9,7 @@ typedef struct {
int free_entries; int free_entries;
int total_entries; int total_entries;
} nvs_stats_t; } nvs_stats_t;
inline nvs_get_stats(void* p, nvs_stats_t* r) { inline int nvs_get_stats(void* p, nvs_stats_t* r) {
return -1; return -1;
} }
inline void nvs_erase_all(nvs_handle h) {} inline void nvs_erase_all(nvs_handle h) {}

View File

@@ -5,7 +5,13 @@
#include "Grbl.h" #include "Grbl.h"
#ifdef NATIVE #ifdef NATIVE
# include <conio.h> # if __WIN32
# include <conio.h>
# else
# define putch putchar
# define getch getchar
# define kbhit() 0
# endif
Uart::Uart(int uart_num) : _uart_num(uart_port_t(uart_num)), _pushback(-1) {} Uart::Uart(int uart_num) : _uart_num(uart_port_t(uart_num)), _pushback(-1) {}
void Uart::begin(unsigned long baudrate, Data dataBits, Stop stopBits, Parity parity) {} void Uart::begin(unsigned long baudrate, Data dataBits, Stop stopBits, Parity parity) {}

View File

@@ -74,7 +74,9 @@ namespace WebUI {
COMMANDS::wait(0); COMMANDS::wait(0);
//in case of restart requested //in case of restart requested
if (restart_ESP_module) { if (restart_ESP_module) {
#ifndef EPOXY_DUINO
ESP.restart(); ESP.restart();
#endif
while (1) {} while (1) {}
} }
} }

View File

@@ -27,7 +27,7 @@
#endif #endif
#include <FS.h> #include <FS.h>
#include <SPIFFS.h> #include <SPIFFS.h>
#ifndef NATIVE #ifndef EPOXY_DUINO
# include <esp_wifi.h> # include <esp_wifi.h>
# include <esp_ota_ops.h> # include <esp_ota_ops.h>
#endif #endif
@@ -248,7 +248,7 @@ namespace WebUI {
#else #else
webPrint("no"); webPrint("no");
#endif #endif
#ifndef NATIVE #ifndef EPOXY_DUINO
# if defined(ENABLE_WIFI) # if defined(ENABLE_WIFI)
# if defined(ENABLE_HTTP) # if defined(ENABLE_HTTP)
webPrint(" # webcommunication: Sync: ", String(web_server.port() + 1)); webPrint(" # webcommunication: Sync: ", String(web_server.port() + 1));
@@ -281,8 +281,10 @@ namespace WebUI {
static Error SPIFFSSize(char* parameter, AuthenticationLevel auth_level) { // ESP720 static Error SPIFFSSize(char* parameter, AuthenticationLevel auth_level) { // ESP720
webPrint(parameter); webPrint(parameter);
#ifndef EPOXY_DUINO
webPrint("SPIFFS Total:", ESPResponseStream::formatBytes(SPIFFS.totalBytes())); webPrint("SPIFFS Total:", ESPResponseStream::formatBytes(SPIFFS.totalBytes()));
webPrintln(" Used:", ESPResponseStream::formatBytes(SPIFFS.usedBytes())); webPrintln(" Used:", ESPResponseStream::formatBytes(SPIFFS.usedBytes()));
#endif
return Error::Ok; return Error::Ok;
} }
@@ -292,13 +294,15 @@ namespace WebUI {
return Error::InvalidValue; return Error::InvalidValue;
} }
webPrint("Formatting"); webPrint("Formatting");
#ifndef EPOXY_DUINO
SPIFFS.format(); SPIFFS.format();
#endif
webPrintln("...Done"); webPrintln("...Done");
return Error::Ok; return Error::Ok;
} }
static Error runLocalFile(char* parameter, AuthenticationLevel auth_level) { // ESP700 static Error runLocalFile(char* parameter, AuthenticationLevel auth_level) { // ESP700
#ifndef NATIVE #ifndef EPOXY_DUINO
if (sys.state != State::Idle) { if (sys.state != State::Idle) {
webPrintln("Busy"); webPrintln("Busy");
return Error::IdleError; return Error::IdleError;
@@ -311,7 +315,7 @@ namespace WebUI {
webPrintln("Error: No such file!"); webPrintln("Error: No such file!");
return Error::FsFileNotFound; return Error::FsFileNotFound;
} }
File currentfile = SPIFFS.open(path, FILE_READ); File currentfile = SPIFFS.open(path, "r");
if (!currentfile) { //if file open success if (!currentfile) { //if file open success
return Error::FsFailedOpenFile; return Error::FsFailedOpenFile;
} }
@@ -334,7 +338,7 @@ namespace WebUI {
currentfile.close(); currentfile.close();
return accumErr; return accumErr;
#else #else
Error::Ok; return Error::Ok;
#endif #endif
} }
@@ -346,11 +350,12 @@ namespace WebUI {
if ((path.length() > 0) && (path[0] != '/')) { if ((path.length() > 0) && (path[0] != '/')) {
path = "/" + path; path = "/" + path;
} }
#ifndef EPOXY_DUINO
if (!SPIFFS.exists(path)) { if (!SPIFFS.exists(path)) {
webPrintln("Error: No such file!"); webPrintln("Error: No such file!");
return Error::FsFileNotFound; return Error::FsFileNotFound;
} }
File currentfile = SPIFFS.open(path, FILE_READ); File currentfile = SPIFFS.open(path, "r");
if (!currentfile) { if (!currentfile) {
return Error::FsFailedOpenFile; return Error::FsFailedOpenFile;
} }
@@ -362,6 +367,7 @@ namespace WebUI {
webPrintln(currentfile.readStringUntil('\n')); webPrintln(currentfile.readStringUntil('\n'));
} }
currentfile.close(); currentfile.close();
#endif
return Error::Ok; return Error::Ok;
} }
@@ -431,7 +437,7 @@ namespace WebUI {
} }
static Error showSysStats(char* parameter, AuthenticationLevel auth_level) { // ESP420 static Error showSysStats(char* parameter, AuthenticationLevel auth_level) { // ESP420
#ifndef NATIVE #ifndef EPOXY_DUINO
webPrintln("Chip ID: ", String((uint16_t)(ESP.getEfuseMac() >> 32))); webPrintln("Chip ID: ", String((uint16_t)(ESP.getEfuseMac() >> 32)));
webPrintln("CPU Frequency: ", String(ESP.getCpuFreqMHz()) + "Mhz"); webPrintln("CPU Frequency: ", String(ESP.getCpuFreqMHz()) + "Mhz");
webPrintln("CPU Temperature: ", String(temperatureRead(), 1) + "C"); webPrintln("CPU Temperature: ", String(temperatureRead(), 1) + "C");
@@ -455,7 +461,9 @@ namespace WebUI {
} }
} }
webPrintln("Available Size for update: ", ESPResponseStream::formatBytes(flashsize)); webPrintln("Available Size for update: ", ESPResponseStream::formatBytes(flashsize));
# ifndef EPOXY_DUINO
webPrintln("Available Size for SPIFFS: ", ESPResponseStream::formatBytes(SPIFFS.totalBytes())); webPrintln("Available Size for SPIFFS: ", ESPResponseStream::formatBytes(SPIFFS.totalBytes()));
# endif
# if defined(ENABLE_HTTP) # if defined(ENABLE_HTTP)
webPrintln("Web port: ", String(web_server.port())); webPrintln("Web port: ", String(web_server.port()));
@@ -615,7 +623,7 @@ namespace WebUI {
#ifdef ENABLE_WIFI #ifdef ENABLE_WIFI
static Error listAPs(char* parameter, AuthenticationLevel auth_level) { // ESP410 static Error listAPs(char* parameter, AuthenticationLevel auth_level) { // ESP410
# ifndef NATIVE # ifndef EPOXY_DUINO
JSONencoder j(espresponse->client() != CLIENT_WEBUI); JSONencoder j(espresponse->client() != CLIENT_WEBUI);
j.begin(); j.begin();
j.begin_array("AP_LIST"); j.begin_array("AP_LIST");
@@ -706,11 +714,13 @@ namespace WebUI {
return Error::FsFailedBusy; return Error::FsFailedBusy;
} }
} }
# ifndef EPOXY_DUINO
if (!openFile(SD, path.c_str())) { if (!openFile(SD, path.c_str())) {
report_status_message(Error::FsFailedRead, (espresponse) ? espresponse->client() : CLIENT_ALL); report_status_message(Error::FsFailedRead, (espresponse) ? espresponse->client() : CLIENT_ALL);
webPrintln(""); webPrintln("");
return Error::FsFailedOpenFile; return Error::FsFailedOpenFile;
} }
# endif
return Error::Ok; return Error::Ok;
} }
static Error showSDFile(char* parameter, AuthenticationLevel auth_level) { // ESP221 static Error showSDFile(char* parameter, AuthenticationLevel auth_level) { // ESP221
@@ -775,7 +785,8 @@ namespace WebUI {
if (parameter[0] != '/') { if (parameter[0] != '/') {
path = "/" + path; path = "/" + path;
} }
File file2del = SD.open(path); # ifndef EPOXY_DUINO
File file2del = SD.open(path, "r");
if (!file2del) { if (!file2del) {
webPrintln("Cannot stat file!"); webPrintln("Cannot stat file!");
return Error::FsFileNotFound; return Error::FsFileNotFound;
@@ -794,11 +805,12 @@ namespace WebUI {
webPrintln("File deleted."); webPrintln("File deleted.");
} }
file2del.close(); file2del.close();
# endif
return Error::Ok; return Error::Ok;
} }
static Error listSDFiles(char* parameter, AuthenticationLevel auth_level) { // ESP210 static Error listSDFiles(char* parameter, AuthenticationLevel auth_level) { // ESP210
# ifndef NATIVE # ifndef EPOXY_DUINO
SDState state = get_sd_state(true); SDState state = get_sd_state(true);
if (state != SDState::Idle) { if (state != SDState::Idle) {
if (state == SDState::NotPresent) { if (state == SDState::NotPresent) {
@@ -824,7 +836,8 @@ namespace WebUI {
void listDirLocalFS(fs::FS& fs, const char* dirname, uint8_t levels, uint8_t client) { void listDirLocalFS(fs::FS& fs, const char* dirname, uint8_t levels, uint8_t client) {
//char temp_filename[128]; // to help filter by extension TODO: 128 needs a definition based on something //char temp_filename[128]; // to help filter by extension TODO: 128 needs a definition based on something
File root = fs.open(dirname); #ifndef EPOXY_DUINO
File root = fs.open(dirname, "r");
if (!root) { if (!root) {
//FIXME: need proper error for FS and not usd sd one //FIXME: need proper error for FS and not usd sd one
report_status_message(Error::FsFailedOpenDir, client); report_status_message(Error::FsFailedOpenDir, client);
@@ -846,21 +859,25 @@ namespace WebUI {
} }
file = root.openNextFile(); file = root.openNextFile();
} }
#endif
} }
static Error listLocalFiles(char* parameter, AuthenticationLevel auth_level) { // No ESP command static Error listLocalFiles(char* parameter, AuthenticationLevel auth_level) { // No ESP command
webPrintln(""); webPrintln("");
#ifndef EPOXY_DUINO
listDirLocalFS(SPIFFS, "/", 10, espresponse->client()); listDirLocalFS(SPIFFS, "/", 10, espresponse->client());
String ssd = "[Local FS Free:" + ESPResponseStream::formatBytes(SPIFFS.totalBytes() - SPIFFS.usedBytes()); String ssd = "[Local FS Free:" + ESPResponseStream::formatBytes(SPIFFS.totalBytes() - SPIFFS.usedBytes());
ssd += " Used:" + ESPResponseStream::formatBytes(SPIFFS.usedBytes()); ssd += " Used:" + ESPResponseStream::formatBytes(SPIFFS.usedBytes());
ssd += " Total:" + ESPResponseStream::formatBytes(SPIFFS.totalBytes()); ssd += " Total:" + ESPResponseStream::formatBytes(SPIFFS.totalBytes());
ssd += "]"; ssd += "]";
webPrintln(ssd); webPrintln(ssd);
#endif
return Error::Ok; return Error::Ok;
} }
static void listDirJSON(fs::FS& fs, const char* dirname, uint8_t levels, JSONencoder* j) { static void listDirJSON(fs::FS& fs, const char* dirname, uint8_t levels, JSONencoder* j) {
File root = fs.open(dirname); #ifndef EPOXY_DUINO
File root = fs.open(dirname, "r");
File file = root.openNextFile(); File file = root.openNextFile();
while (file) { while (file) {
const char* tailName = strchr(file.name(), '/'); const char* tailName = strchr(file.name(), '/');
@@ -877,17 +894,20 @@ namespace WebUI {
} }
file = root.openNextFile(); file = root.openNextFile();
} }
#endif
} }
static Error listLocalFilesJSON(char* parameter, AuthenticationLevel auth_level) { // No ESP command static Error listLocalFilesJSON(char* parameter, AuthenticationLevel auth_level) { // No ESP command
JSONencoder j(espresponse->client() != CLIENT_WEBUI); JSONencoder j(espresponse->client() != CLIENT_WEBUI);
j.begin(); j.begin();
j.begin_array("files"); j.begin_array("files");
#ifndef EPOXY_DUINO
listDirJSON(SPIFFS, "/", 4, &j); listDirJSON(SPIFFS, "/", 4, &j);
j.end_array(); j.end_array();
j.member("total", SPIFFS.totalBytes()); j.member("total", SPIFFS.totalBytes());
j.member("used", SPIFFS.usedBytes()); j.member("used", SPIFFS.usedBytes());
j.member("occupation", String(100 * SPIFFS.usedBytes() / SPIFFS.totalBytes())); j.member("occupation", String(100 * SPIFFS.usedBytes() / SPIFFS.totalBytes()));
#endif
webPrint(j.end()); webPrint(j.end());
if (espresponse->client() != CLIENT_WEBUI) { if (espresponse->client() != CLIENT_WEBUI) {
webPrintln(""); webPrintln("");
@@ -916,7 +936,7 @@ namespace WebUI {
} }
static Error setRadioState(char* parameter, AuthenticationLevel auth_level) { // ESP115 static Error setRadioState(char* parameter, AuthenticationLevel auth_level) { // ESP115
#ifndef NATIVE #ifndef EPOXY_DUINO
parameter = trim(parameter); parameter = trim(parameter);
if (*parameter == '\0') { if (*parameter == '\0') {
// Display the radio state // Display the radio state
@@ -993,7 +1013,7 @@ namespace WebUI {
#ifdef ENABLE_WIFI #ifdef ENABLE_WIFI
static Error showIP(char* parameter, AuthenticationLevel auth_level) { // ESP111 static Error showIP(char* parameter, AuthenticationLevel auth_level) { // ESP111
# ifndef NATIVE # ifndef EPOXY_DUINO
webPrintln(parameter, WiFi.getMode() == WIFI_STA ? WiFi.localIP() : WiFi.softAPIP()); webPrintln(parameter, WiFi.getMode() == WIFI_STA ? WiFi.localIP() : WiFi.softAPIP());
# endif # endif
return Error::Ok; return Error::Ok;

View File

@@ -23,7 +23,7 @@
#ifdef ENABLE_WIFI #ifdef ENABLE_WIFI
# include <WiFi.h> # include <WiFi.h>
# ifndef NATIVE # ifndef EPOXY_DUINO
# include <esp_wifi.h> # include <esp_wifi.h>
# include <ESPmDNS.h> # include <ESPmDNS.h>
# include <FS.h> # include <FS.h>
@@ -54,7 +54,7 @@ namespace WebUI {
String tmp; String tmp;
result = "[MSG:"; result = "[MSG:";
# ifndef NATIVE # ifndef EPOXY_DUINO
if ((WiFi.getMode() == WIFI_MODE_STA) || (WiFi.getMode() == WIFI_MODE_APSTA)) { if ((WiFi.getMode() == WIFI_MODE_STA) || (WiFi.getMode() == WIFI_MODE_APSTA)) {
result += "Mode=STA:SSID="; result += "Mode=STA:SSID=";
result += WiFi.SSID(); result += WiFi.SSID();
@@ -212,7 +212,7 @@ namespace WebUI {
*/ */
void WiFiConfig::WiFiEvent(WiFiEvent_t event) { void WiFiConfig::WiFiEvent(WiFiEvent_t event) {
# ifndef NATIVE # ifndef EPOXY_DUINO
switch (event) { switch (event) {
case SYSTEM_EVENT_STA_GOT_IP: case SYSTEM_EVENT_STA_GOT_IP:
grbl_sendf(CLIENT_ALL, "[MSG:Connected with %s]\r\n", WiFi.localIP().toString().c_str()); grbl_sendf(CLIENT_ALL, "[MSG:Connected with %s]\r\n", WiFi.localIP().toString().c_str());
@@ -244,7 +244,7 @@ namespace WebUI {
*/ */
bool WiFiConfig::ConnectSTA2AP() { bool WiFiConfig::ConnectSTA2AP() {
# ifdef NATIVE # ifdef EPOXY_DUINO
return false; return false;
# else # else
String msg, msg_out; String msg, msg_out;
@@ -285,7 +285,7 @@ namespace WebUI {
*/ */
bool WiFiConfig::StartSTA() { bool WiFiConfig::StartSTA() {
# ifdef NATIVE # ifdef EPOXY_DUINO
return false; return false;
# else # else
//stop active service //stop active service
@@ -334,7 +334,7 @@ namespace WebUI {
*/ */
bool WiFiConfig::StartAP() { bool WiFiConfig::StartAP() {
# ifdef NATIVE # ifdef EPOXY_DUINO
return false; return false;
# else # else
//stop active services //stop active services
@@ -384,7 +384,7 @@ namespace WebUI {
*/ */
void WiFiConfig::StopWiFi() { void WiFiConfig::StopWiFi() {
# ifndef NATIVE # ifndef EPOXY_DUINO
//Sanity check //Sanity check
if ((WiFi.getMode() == WIFI_STA) || (WiFi.getMode() == WIFI_AP_STA)) { if ((WiFi.getMode() == WIFI_STA) || (WiFi.getMode() == WIFI_AP_STA)) {
WiFi.disconnect(true); WiFi.disconnect(true);
@@ -404,7 +404,7 @@ namespace WebUI {
* begin WiFi setup * begin WiFi setup
*/ */
void WiFiConfig::begin() { void WiFiConfig::begin() {
# ifndef NATIVE # ifndef EPOXY_DUINO
//stop active services //stop active services
wifi_services.end(); wifi_services.end();
//setup events //setup events
@@ -455,7 +455,7 @@ namespace WebUI {
grbl_send(CLIENT_ALL, "[MSG:WiFi reset done]\r\n"); grbl_send(CLIENT_ALL, "[MSG:WiFi reset done]\r\n");
} }
bool WiFiConfig::Is_WiFi_on() { bool WiFiConfig::Is_WiFi_on() {
# ifdef NATIVE # ifdef EPOXY_DUINO
return false; return false;
# else # else
return !(WiFi.getMode() == WIFI_MODE_NULL); return !(WiFi.getMode() == WIFI_MODE_NULL);

View File

@@ -10,11 +10,10 @@ from pathlib import Path
env = dict(os.environ) env = dict(os.environ)
# pioEnv='windows'
pioEnv='native' pioEnv='native'
def convertMachine(baseName, verbose=True, extraArgs=None): def convertMachine(baseName, verbose=True, extraArgs=None):
cmd = ['platformio','run','-e', pioEnv] cmd = ['platformio','run','-e',pioEnv]
if extraArgs: if extraArgs:
cmd.append(extraArgs) cmd.append(extraArgs)
displayName = baseName displayName = baseName
@@ -31,7 +30,7 @@ def convertMachine(baseName, verbose=True, extraArgs=None):
print(line, end='') print(line, end='')
app.wait() app.wait()
if app.returncode == 0: if app.returncode == 0:
cmd = [ '.pio/build/' + pioEnv + '/program.exe' ] cmd = [ '.pio/build/' + pioEnv + '/program' ]
out_filename = "yaml/" + Path(baseName).stem + ".yaml" out_filename = "yaml/" + Path(baseName).stem + ".yaml"
app = subprocess.Popen(cmd, env=env, stdout=open(out_filename, "w"), stderr=subprocess.STDOUT, bufsize=1) app = subprocess.Popen(cmd, env=env, stdout=open(out_filename, "w"), stderr=subprocess.STDOUT, bufsize=1)
app.wait() app.wait()

View File

@@ -20,7 +20,7 @@ public:
BluetoothSerial(void) = default; BluetoothSerial(void) = default;
~BluetoothSerial(void) = default; ~BluetoothSerial(void) = default;
bool begin(String localName = String(), bool isMaster = false) {} bool begin(String localName = String(), bool isMaster = false) { return false; }
void register_callback(void (*callback)(esp_spp_cb_event_t event, esp_spp_cb_param_t* param)) {} void register_callback(void (*callback)(esp_spp_cb_event_t event, esp_spp_cb_param_t* param)) {}
bool hasClient(void) { return false; } bool hasClient(void) { return false; }
void end(void) {} void end(void) {}

View File

@@ -1,3 +1,12 @@
#include "ESP.h" #include <Arduino.h>
#if EPOXY_DUINO_VERSION < 10000
# include "ESP.h"
EspClass ESP; EspClass ESP;
#else
# include <stdint.h>
extern "C" {
void attachInterrupt(uint8_t pin, void (*isr_limit_switches)(), int change) {}
void detachInterrupt(uint8_t pin) {}
}
#endif

View File

@@ -19,8 +19,11 @@ inline uint32_t getApbFrequency() {
} }
inline void gpio_reset_pin(uint8_t pin) {} inline void gpio_reset_pin(uint8_t pin) {}
inline int digitalPinToInterrupt(uint8_t pin) {} inline int digitalPinToInterrupt(uint8_t pin) {
return 0;
}
#ifndef EPOXY_DUINO
// Most of the EspClass stuff is used by information reports, // Most of the EspClass stuff is used by information reports,
// except for restart() // except for restart()
class EspClass { class EspClass {
@@ -33,11 +36,12 @@ public:
inline uint32_t getFlashChipSize() { return 0x400000; } inline uint32_t getFlashChipSize() { return 0x400000; }
}; };
extern EspClass ESP; extern EspClass ESP;
#endif
#define NO_TASKS #define NO_TASKS
inline void attachInterrupt(int pin, void (*isr_limit_switches)(), int change) {} void attachInterrupt(uint8_t pin, void (*isr_limit_switches)(), int change);
inline void detachInterrupt(int pin) {} void detachInterrupt(uint8_t pin);
inline void NOP() {} inline void NOP() {}

View File

@@ -1,4 +1,6 @@
#include <FS.h> #include <Arduino.h>
#if EPOXY_DUINO_VERSION < 10000
# include <FS.h>
using namespace fs; using namespace fs;
@@ -112,10 +114,11 @@ bool FS::rmdir(const String& path) {
return rmdir(path.c_str()); return rmdir(path.c_str());
} }
#if 0 # if 0
void FSImpl::mountpoint(const char* mp) {} void FSImpl::mountpoint(const char* mp) {}
const char* FSImpl::mountpoint() { const char* FSImpl::mountpoint() {
return ""; return "";
} }
# endif
#endif #endif

View File

@@ -1,3 +1,4 @@
#if EPOXY_DUINO_VERSION < 10000
#pragma once #pragma once
#include <Stream.h> #include <Stream.h>
@@ -61,3 +62,4 @@ using fs::SeekCur;
using fs::SeekEnd; using fs::SeekEnd;
using fs::SeekMode; using fs::SeekMode;
using fs::SeekSet; using fs::SeekSet;
#endif

View File

@@ -2,7 +2,11 @@
#include <SPI.h> #include <SPI.h>
#include <FS.h> #include <FS.h>
#if EPOXY_DUINO_VERSION < 10000
class SDFS : public FS { class SDFS : public FS {
#else
class SDFS {
#endif
public: public:
bool begin(uint8_t sspin, SPIClass& spi, int freq, const char* mountpoint, int n_files) { return false; }; bool begin(uint8_t sspin, SPIClass& spi, int freq, const char* mountpoint, int n_files) { return false; };
void end() {} void end() {}

View File

@@ -1,3 +1,6 @@
#include <SPIFFS.h> #include <Arduino.h>
#if EPOXY_DUINO_VERSION < 10000
# include <SPIFFS.h>
fs::SPIFFSFS SPIFFS; fs::SPIFFSFS SPIFFS;
#endif

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include <Arduino.h>
#if EPOXY_DUINO_VERSION < 10000
#include <FS.h> # include <FS.h>
namespace fs { namespace fs {
class SPIFFSFS : public FS { class SPIFFSFS : public FS {
@@ -22,3 +24,4 @@ namespace fs {
} }
extern fs::SPIFFSFS SPIFFS; extern fs::SPIFFSFS SPIFFS;
#endif

View File

@@ -1,5 +1,7 @@
#pragma once #pragma once
extern "C" { extern "C" {
inline esp_err_t esp_task_wdt_reset() {} inline esp_err_t esp_task_wdt_reset() {
return 0;
}
} }

View File

@@ -18,9 +18,13 @@ const BaseType_t pdTRUE = 1;
const BaseType_t pdFALSE = 0; const BaseType_t pdFALSE = 0;
const BaseType_t pdPASS = 0; const BaseType_t pdPASS = 0;
inline void vTaskDelay(TickType_t ticks) {} inline void vTaskDelay(TickType_t ticks) {}
inline BaseType_t xQueueReceive(QueueHandle_t xQueue, void* pvBuffer, TickType_t xTicksToWait) {} inline BaseType_t xQueueReceive(QueueHandle_t xQueue, void* pvBuffer, TickType_t xTicksToWait) {
inline xQueueHandle xQueueCreate(int n, int len) {} return pdFALSE;
inline BaseType_t xQueueReset(QueueHandle_t queue) { }
inline xQueueHandle xQueueCreate(int n, int len) {
return nullptr;
}
inline BaseType_t xQueueReset(QueueHandle_t queue) {
return pdPASS; return pdPASS;
} }
inline BaseType_t xQueueSend(QueueHandle_t queue, void* item, TickType_t ticks) { inline BaseType_t xQueueSend(QueueHandle_t queue, void* item, TickType_t ticks) {
@@ -29,9 +33,13 @@ inline BaseType_t xQueueSend(QueueHandle_t queue, void* item, TickType_t ticks)
inline BaseType_t xQueueSendFromISR(QueueHandle_t queue, void* item, void* p) { inline BaseType_t xQueueSendFromISR(QueueHandle_t queue, void* item, void* p) {
return pdTRUE; return pdTRUE;
} }
inline TaskHandle_t xTaskCreate(void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th) {} inline TaskHandle_t xTaskCreate(void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th) {
return nullptr;
}
inline TaskHandle_t xTaskCreatePinnedToCore( inline TaskHandle_t xTaskCreatePinnedToCore(
void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th, int core) {} void (*task)(void*), const char* name, int stacksize, void* arg0, int pri, TaskHandle_t* th, int core) {
return nullptr;
}
inline int xTaskGetTickCount() { inline int xTaskGetTickCount() {
return 0; return 0;
} }

View File

@@ -2,19 +2,23 @@
#include <ctype.h> #include <ctype.h>
#include <binary.h> #include <binary.h>
inline bool isPrintable(int c) {
return (isprint(c) == 0 ? false : true);
}
#define IRAM_ATTR #define IRAM_ATTR
// The native compiler might not support __attribute__ ((weak)) // The native compiler might not support __attribute__ ((weak))
#define WEAK_FUNC #define WEAK_FUNC
// Unlike the ESP32 Arduino framework, EpoxyDuino does not have contrain() and map() #if EPOXY_DUINO_VERSION < 10000
inline bool isPrintable(int c) {
return (isprint(c) == 0 ? false : true);
}
#else
static const uint8_t SS = 1;
#endif
#if EPOXY_DUINO_VERSION < 10100
// Templates don't work because of float/double promotion // Templates don't work because of float/double promotion
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt))) # define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
#endif
inline long map(long x, long in_min, long in_max, long out_min, long out_max) { inline long map(long x, long in_min, long in_max, long out_min, long out_max) {
const long dividend = out_max - out_min; const long dividend = out_max - out_min;
@@ -26,7 +30,9 @@ inline long map(long x, long in_min, long in_max, long out_min, long out_max) {
return (delta * dividend + (divisor / 2)) / divisor + out_min; return (delta * dividend + (divisor / 2)) / divisor + out_min;
} }
#define M_PI 3.1415926536 #ifndef M_PI // native on linux
# define M_PI 3.1415926536
#endif
#define GPIO_NUM_0 0 #define GPIO_NUM_0 0
#define GPIO_NUM_1 1 #define GPIO_NUM_1 1
@@ -68,19 +74,3 @@ inline long map(long x, long in_min, long in_max, long out_min, long out_max) {
#define GPIO_NUM_37 37 #define GPIO_NUM_37 37
#define GPIO_NUM_38 38 #define GPIO_NUM_38 38
#define GPIO_NUM_39 39 #define GPIO_NUM_39 39
#if 0
# define INPUT 0x0
# define OUTPUT 0x1
# define INPUT_PULLUP 0x2
# define CHANGE 0x03
// Define pins used by I2C and SPI.
static const uint8_t SS = 1;
static const uint8_t MOSI = 2;
static const uint8_t MISO = 3;
static const uint8_t SCK = 4;
static const uint8_t SDA = 5;
static const uint8_t SCL = 6;
#endif

View File

@@ -20,7 +20,7 @@ inline esp_err_t nvs_get_i8(int _handle, const char* _keyName, signed char* valu
inline esp_err_t nvs_set_i8(int _handle, const char* _keyName, int value) { inline esp_err_t nvs_set_i8(int _handle, const char* _keyName, int value) {
return -1; return -1;
} }
inline esp_err_t nvs_get_str(int _handle, const char* _keyName, void* p, unsigned int* len) { inline esp_err_t nvs_get_str(int _handle, const char* _keyName, void* p, size_t* len) {
return -1; return -1;
} }
inline esp_err_t nvs_set_str(int _handle, const char* _keyName, const char* value) { inline esp_err_t nvs_set_str(int _handle, const char* _keyName, const char* value) {

View File

@@ -71,20 +71,22 @@ src_filter =
+<*.h> +<*.s> +<*.S> +<*.cpp> +<*.c> +<*.ino> +<src/> +<*.h> +<*.s> +<*.S> +<*.cpp> +<*.c> +<*.ino> +<src/>
-<.git/> -<data/> -<test/> -<tests/> -<.git/> -<data/> -<test/> -<tests/>
[env:windows] [host]
platform = windows_x86
build_flags = build_flags =
${common.build_flags} ${common.build_flags}
--std=c++17 --std=c++17
-DARDUINO=100 -DARDUINO=100
-DEPOXY_DUINO
-DEPOXY_CORE_ESP8266
-DNATIVE -DNATIVE
-DCONFIG_BT_ENABLED -DCONFIG_BT_ENABLED
-DCONFIG_BLUEDROID_ENABLED -DCONFIG_BLUEDROID_ENABLED
lib_ldf_mode = deep lib_ldf_mode = deep
lib_deps = lib_deps =
EpoxyDuino=https://github.com/bxparks/EpoxyDuino.git#v0.7.0
EpoxyEepromEsp
TMCStepper TMCStepper
EpoxyDuino=https://github.com/MitchBradley/EpoxyDuino.git#mingw_piofix
# Change to the following when PR #42 is accepted and released
# EpoxyDuino=https://github.com/bxparks/EpoxyDuino.git#v1.2.0
lib_ignore = WebSockets, ESP32SSPD lib_ignore = WebSockets, ESP32SSPD
lib_compat_mode = off lib_compat_mode = off
src_filter = src_filter =
@@ -92,23 +94,20 @@ src_filter =
-<.git/> -<data/> -<test/> -<tests/> -<.git/> -<data/> -<test/> -<tests/>
-<arduinoWebSockets/> -<arduinoWebSockets/>
[env:windows]
platform = windows_x86
build_flags = ${host.build_flags}
lib_ldf_mode = ${host.lib_ldf_mode}
lib_deps = ${host.lib_deps}
lib_ignore = ${host.lib_ignore}
lib_compat_mode = ${host.lib_compat_mode}
src_filter = ${host.src_filter}
[env:native] [env:native]
platform = native platform = native
build_flags = build_flags = ${host.build_flags}
${common.build_flags} lib_ldf_mode = ${host.lib_ldf_mode}
--std=c++17 lib_deps = ${host.lib_deps}
-DARDUINO=100 lib_ignore = ${host.lib_ignore}
-DNATIVE lib_compat_mode = ${host.lib_compat_mode}
-DCONFIG_BT_ENABLED src_filter = ${host.src_filter}
-DCONFIG_BLUEDROID_ENABLED
lib_ldf_mode = deep
lib_deps =
EpoxyDuino=https://github.com/bxparks/EpoxyDuino.git#v0.7.0
EpoxyEepromEsp
TMCStepper
lib_ignore = WebSockets, ESP32SSPD
lib_compat_mode = off
src_filter =
+<*.h> +<*.s> +<*.S> +<*.cpp> +<*.c> +<*.ino> +<src/>
-<.git/> -<data/> -<test/> -<tests/>
-<arduinoWebSockets/>