Skip to content
Snippets Groups Projects
Commit d765081b authored by Maximilien Naveau's avatar Maximilien Naveau
Browse files

Create a make.sh inorder to build the web server app locally

parent a7635865
No related branches found
No related tags found
No related merge requests found
......@@ -87,4 +87,19 @@ firefox localhost:9080
### ESP
@todo
\ No newline at end of file
@todo
## Some code details explanation
### CORE_MOCK
Ce `CORE_MOCK` permet d'ignorer les ligne qui sont spécifique au micro-controller
afin de compiler le driver sur le PC local. Cela permet notamment de visualiser
le gui sans avoir la carte éléctronique physiquement et de la flasher.
```
#if !CORE_MOCK
// on the target
#else // !CORE_MOCK
// on host
#endif // !CORE_MOCK
```
\ No newline at end of file
#!/bin/sh -ex
cd ${ESP8266ARDUINO}/tests/host
make clean
#!/bin/sh -ex
cd ${ESP8266ARDUINO}/tests/host
make FORCE32=0 ssl
make -j 10 FORCE32=0 D=1 USERCFLAGS="-I ${ARDUINOLIB}/emuAsync/replacement" ULIBDIRS=${ARDUINOLIB}/emuAsync:${ARDUINOLIB}/ESPUI:${ARDUINOLIB}/ArduinoJson:${ARDUINOLIB}/arduinoWebSockets ${ARDUINOLIB}/pousseseringue-arduino/pousseseringue-arduino
\ No newline at end of file
......@@ -3,7 +3,6 @@
// Feather LCD
// Feather motor controler
#if 0
#define STASSID "laas-capture"
#define STAPSK ""
......@@ -53,9 +52,10 @@
#include <ESP8266WiFi.h> // internal, wifi library
#include <DNSServer.h> // internal, access point mode
#if !CORE_MOCK
#include <SSD1306AsciiWire.h> // https://github.com/greiman/SSD1306Ascii
#include <A4988.h> // https://github.com/laurb9/StepperDriver
#endif // !CORE_MOCK
#include "Debouncer.h" // local, debouncer, short counter, long detector
#include "common.h"
......@@ -69,8 +69,10 @@ enum class Modes { TURN, TURNSetup, RPM, RPMSetup, INFO };
millis_t nowMs; // to update on main loop(): "nowMs = millis();"
Debouncer<nowMs> bA, bB, bC;
#if !CORE_MOCK
A4988 a4988(MOTOR_STEPS, DIR, STEP, SLEEP);
SSD1306AsciiWire oled;
#endif // !CORE_MOCK
constexpr int DNS_PORT = 53;
DNSServer dnsServer;
......@@ -106,11 +108,14 @@ const char* oledMode ()
void oledPrintMode ()
{
#if !CORE_MOCK
oled.printf("\n mode: %s", oledMode());
#endif // !CORE_MOCK
}
void oledRedisplay ()
{
#if !CORE_MOCK
oled.clear();
switch (mode)
......@@ -151,6 +156,7 @@ void oledRedisplay ()
default:
oled.printf("?");
}
#endif // !CORE_MOCK
}
void changeMode ()
......@@ -212,20 +218,26 @@ void setup()
{
Serial.begin(74880);
Serial.setDebugOutput(true);
#if !CORE_MOCK
Wire.begin();
Wire.setClock(400000L);
#endif // !CORE_MOCK
delay(500);
#if !CORE_MOCK
oled.begin(&OLED_HW, OLED_I2C);
oled.setFont(System5x7);
oled.setScrollMode(SCROLL_MODE_AUTO);
oled.clear();
oled.println("Booting...\n");
#endif // !CORE_MOCK
#if !CORE_MOCK
a4988.begin(STEPPER_RPM); // some value is necessary
a4988.setEnableActiveState(LOW);
a4988.setMicrostep(MICROSTEPS_CONF);
a4988.enable();
#endif // !CORE_MOCK
uint8_t mac[6];
WiFi.macAddress(mac);
......@@ -309,12 +321,16 @@ void loop()
if (move >= stepsPerDuration)
{
move -= stepsPerDuration;
#if !CORE_MOCK
a4988.move(stepsPerDuration); // forward revolution
#endif // !CORE_MOCK
}
if (move <= -stepsPerDuration)
{
move += stepsPerDuration;
#if !CORE_MOCK
a4988.move(-stepsPerDuration); // backward revolution
#endif // !CORE_MOCK
}
lastMoveMs += stepDurationMs;
......
// please edit this file: pousseseringue-arduino.cpp
// Pour la compilation local sur le PC
#if CORE_MOCK
#include "pousseseringue-arduino.cpp"
#include "web.cpp"
#endif // !CORE_MOCK
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment