diff --git a/.gitignore b/.gitignore index 4282769..1bc6e73 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /schema/*/_autosave-*.sch /schema/*/*-backups +/.metadata/ diff --git a/ESP32/.cproject b/ESP32/.cproject new file mode 100644 index 0000000..e326db6 --- /dev/null +++ b/ESP32/.cproject @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ESP32/.gitignore b/ESP32/.gitignore new file mode 100644 index 0000000..84c048a --- /dev/null +++ b/ESP32/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/ESP32/.project b/ESP32/.project new file mode 100644 index 0000000..978d3e4 --- /dev/null +++ b/ESP32/.project @@ -0,0 +1,20 @@ + + + ESP32 + + + + + + org.eclipse.cdt.core.cBuilder + clean,full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.make.core.makeNature + + diff --git a/ESP32/ESP32.ino b/ESP32/ESP32.ino new file mode 100644 index 0000000..34a67dc --- /dev/null +++ b/ESP32/ESP32.ino @@ -0,0 +1,3 @@ +// This file only exists to make the Arduino IDE happy +// The actual entry points are in vehicle-monitor.cpp (because .ino extension is non-standard) +// Notice we don't even need to include anything as the Arduino IDE automatically compiles all .cpp files that are in the sketch folder diff --git a/ESP32/vehicle-monitor.cpp b/ESP32/vehicle-monitor.cpp new file mode 100644 index 0000000..06baa90 --- /dev/null +++ b/ESP32/vehicle-monitor.cpp @@ -0,0 +1,31 @@ +/* The true ESP32 chip ID is essentially its MAC address. +This sketch provides an alternate chip ID that matches +the output of the ESP.getChipId() function on ESP8266 +(i.e. a 32-bit integer matching the last 3 bytes of +the MAC address. This is less unique than the +MAC address chip ID, but is helpful when you need +an identifier that can be no more than a 32-bit integer +(like for switch...case). + +created 2020-06-07 by cweinhofer +with help from Cicicok */ + +#include + +uint32_t chipId = 0; + +void setup() { + Serial.begin(115200); +} + +void loop() { + for(int i=0; i<17; i=i+8) { + chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i; + } + + Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision()); + Serial.printf("This chip has %d cores\n", ESP.getChipCores()); + Serial.print("Chip ID: "); Serial.println(chipId); + + delay(3000); +}