Convert all projects to PlatformIO
- JC3636W518 sketches: pioarduino 51.03.05 (Arduino core 3.0.5), ESP32-S3 16MB QIO / OPI PSRAM, vendor libs via lib_extra_dirs, per-project lv_conf.h - display_gif_embedded uses default_16MB.csv (firmware 3.4 MB > huge_app) - elm327_wifi_bridge: espressif32 6.10.0 on esp32dev, pinned lib_deps - elmulator: library in lib/, one env per example, duplicate copies removed - .ino -> src/main.cpp, headers/lv_conf.h -> include/ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9cefb9ba75
commit
5c04e3f0df
81 files changed
+863
-5463
No files matched your search
@@ -0,0 +1,18 @@
|
||||
; ELM327 -> WiFi bridge — runs on a CLASSIC ESP32 (needs Bluetooth Classic, which the ESP32-S3 lacks)
|
||||
; Original note: "needs esp32 2.0.* in boards manager" -> official platform 6.10.0 = Arduino core 2.0.17
|
||||
|
||||
[env:esp32dev]
|
||||
platform = espressif32@6.10.0
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
|
||||
; BluetoothSerial + WiFi + web server do not fit the default 1.2 MB app partition
|
||||
board_build.partitions = huge_app.csv
|
||||
|
||||
lib_deps =
|
||||
powerbroker2/ELMduino@3.4.1
|
||||
esphome/ESPAsyncWebServer-esphome@3.4.0
|
||||
|
||||
; upload_port = COMxx ; set to the classic ESP32's port (COM21 is the JC3636W518)
|
||||
monitor_speed = 115200
|
||||
monitor_filters = esp32_exception_decoder
|
||||
+96
-95
@@ -1,95 +1,96 @@
|
||||
// Import required libraries
|
||||
#include "WiFi.h"
|
||||
#include <ESPAsyncWebServer.h>
|
||||
// needs esp32 2.0.* in boards manaager // https://forum.arduino.cc/t/libary-problem-with-esp32-web-server/1282583/6
|
||||
|
||||
// Set your access point network credentials
|
||||
const char* ssid = "ESP32-Access-Point";
|
||||
const char* password = "123456789";
|
||||
|
||||
|
||||
#include "BluetoothSerial.h"
|
||||
#include "ELMduino.h"
|
||||
|
||||
// Create AsyncWebServer object on port 80
|
||||
AsyncWebServer server(80);
|
||||
|
||||
BluetoothSerial SerialBT;
|
||||
#define ELM_PORT SerialBT
|
||||
#define DEBUG_PORT Serial
|
||||
|
||||
|
||||
ELM327 myELM327;
|
||||
|
||||
|
||||
uint32_t kph = 0;
|
||||
|
||||
String readSpeed() {
|
||||
if (ELM_PORT.isClosed()) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
float tempkph = myELM327.kph();
|
||||
|
||||
if (myELM327.nb_rx_state == ELM_SUCCESS) {
|
||||
kph = (uint32_t)tempkph;
|
||||
Serial.print("kph: ");
|
||||
Serial.println(kph);
|
||||
} else if (myELM327.nb_rx_state != ELM_GETTING_MSG)
|
||||
myELM327.printError();
|
||||
|
||||
return String(kph);
|
||||
// return "123";
|
||||
}
|
||||
|
||||
void connectElm() {
|
||||
if (!ELM_PORT.connect("OBDII")) {
|
||||
DEBUG_PORT.println("Couldn't connect to OBD scanner - Phase 1");
|
||||
// while (1)
|
||||
// ;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myELM327.begin(ELM_PORT, true, 2000)) {
|
||||
Serial.println("Couldn't connect to OBD scanner - Phase 2");
|
||||
// while (1)
|
||||
// ;
|
||||
return;
|
||||
}
|
||||
|
||||
Serial.println("Connected to ELM327");
|
||||
}
|
||||
|
||||
void setup() {
|
||||
DEBUG_PORT.begin(115200);
|
||||
SerialBT.setPin("1234");
|
||||
ELM_PORT.begin("ArduHUD", true);
|
||||
|
||||
Serial.println("Starting ELM327 to wifi bridge");
|
||||
|
||||
//connectElm();
|
||||
|
||||
// Setting the ESP as an access point
|
||||
Serial.print("Setting AP (Access Point)…");
|
||||
// Remove the password parameter, if you want the AP (Access Point) to be open
|
||||
WiFi.softAP(ssid, password);
|
||||
|
||||
IPAddress IP = WiFi.softAPIP();
|
||||
Serial.print("AP IP address: ");
|
||||
Serial.println(IP);
|
||||
|
||||
server.on("/speed", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
request->send_P(200, "text/plain", readSpeed().c_str());
|
||||
});
|
||||
|
||||
// Start server
|
||||
server.begin();
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
if (ELM_PORT.isClosed()) {
|
||||
Serial.println("Trying to reconnect to ELM327");
|
||||
connectElm();
|
||||
}
|
||||
}
|
||||
#include <Arduino.h>
|
||||
// Import required libraries
|
||||
#include "WiFi.h"
|
||||
#include <ESPAsyncWebServer.h>
|
||||
// needs esp32 2.0.* in boards manaager // https://forum.arduino.cc/t/libary-problem-with-esp32-web-server/1282583/6
|
||||
|
||||
// Set your access point network credentials
|
||||
const char* ssid = "ESP32-Access-Point";
|
||||
const char* password = "123456789";
|
||||
|
||||
|
||||
#include "BluetoothSerial.h"
|
||||
#include "ELMduino.h"
|
||||
|
||||
// Create AsyncWebServer object on port 80
|
||||
AsyncWebServer server(80);
|
||||
|
||||
BluetoothSerial SerialBT;
|
||||
#define ELM_PORT SerialBT
|
||||
#define DEBUG_PORT Serial
|
||||
|
||||
|
||||
ELM327 myELM327;
|
||||
|
||||
|
||||
uint32_t kph = 0;
|
||||
|
||||
String readSpeed() {
|
||||
if (ELM_PORT.isClosed()) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
float tempkph = myELM327.kph();
|
||||
|
||||
if (myELM327.nb_rx_state == ELM_SUCCESS) {
|
||||
kph = (uint32_t)tempkph;
|
||||
Serial.print("kph: ");
|
||||
Serial.println(kph);
|
||||
} else if (myELM327.nb_rx_state != ELM_GETTING_MSG)
|
||||
myELM327.printError();
|
||||
|
||||
return String(kph);
|
||||
// return "123";
|
||||
}
|
||||
|
||||
void connectElm() {
|
||||
if (!ELM_PORT.connect("OBDII")) {
|
||||
DEBUG_PORT.println("Couldn't connect to OBD scanner - Phase 1");
|
||||
// while (1)
|
||||
// ;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myELM327.begin(ELM_PORT, true, 2000)) {
|
||||
Serial.println("Couldn't connect to OBD scanner - Phase 2");
|
||||
// while (1)
|
||||
// ;
|
||||
return;
|
||||
}
|
||||
|
||||
Serial.println("Connected to ELM327");
|
||||
}
|
||||
|
||||
void setup() {
|
||||
DEBUG_PORT.begin(115200);
|
||||
SerialBT.setPin("1234");
|
||||
ELM_PORT.begin("ArduHUD", true);
|
||||
|
||||
Serial.println("Starting ELM327 to wifi bridge");
|
||||
|
||||
//connectElm();
|
||||
|
||||
// Setting the ESP as an access point
|
||||
Serial.print("Setting AP (Access Point)…");
|
||||
// Remove the password parameter, if you want the AP (Access Point) to be open
|
||||
WiFi.softAP(ssid, password);
|
||||
|
||||
IPAddress IP = WiFi.softAPIP();
|
||||
Serial.print("AP IP address: ");
|
||||
Serial.println(IP);
|
||||
|
||||
server.on("/speed", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
request->send_P(200, "text/plain", readSpeed().c_str());
|
||||
});
|
||||
|
||||
// Start server
|
||||
server.begin();
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
if (ELM_PORT.isClosed()) {
|
||||
Serial.println("Trying to reconnect to ELM327");
|
||||
connectElm();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user