Commit 1e648abc authored by Thomas Flayols's avatar Thomas Flayols
Browse files
parents d31d2a6b 31b3f7a8
......@@ -99,4 +99,34 @@ firefox localhost:9080
### ESP
@todo
\ No newline at end of file
@todo
## Visualization locale de l'interface utilisateur sans l'arduino.
Compiler l'application localement:
```
# se positionner dans pousseseringue-arduino/
export ESP8266ARDUINO=~/devel/workspace/src/arduino_esp8266
export ARDUINOLIB=~/devel/workspace/src/
cd host_gui
./make.sh
```
lancer le server:
```
${ESP8266ARDUINO}/tests/host/bin/pousseseringue-arduino/pousseseringue-arduino
```
## 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
```
#!/bin/sh -ex
cd ${ESP8266ARDUINO}/tests/host
make clean
#!/bin/sh -ex
pwd=$(pwd)
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 ${pwd}/../pousseseringue-arduino
\ No newline at end of file
......@@ -3,8 +3,6 @@
// Feather LCD
// Feather motor controler
#pragma once // necessary for arduino IDE environment ino source file
#if 0
#define STASSID "laas-capture"
#define STAPSK ""
......@@ -52,9 +50,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 <AccelStepper.h>
#endif // !CORE_MOCK
#include "Debouncer.h" // local, debouncer, short counter, long detector
#include "common.h"
......@@ -67,10 +66,10 @@ millis_t nowMs; // to update on main loop(): "nowMs = millis();"
Debouncer<nowMs> bA, bB, bC;
#if !CORE_MOCK
AccelStepper stepper(AccelStepper::DRIVER, STEP,DIR);
SSD1306AsciiWire oled;
#endif // !CORE_MOCK
constexpr int DNS_PORT = 53;
DNSServer dnsServer;
......@@ -108,11 +107,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)
......@@ -153,6 +155,7 @@ void oledRedisplay ()
default:
oled.printf("?");
}
#endif // !CORE_MOCK
}
void changeMode ()
......@@ -214,21 +217,24 @@ void setup()
{
Serial.begin(9600);
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
stepper.setMaxSpeed(10000);
stepper.setAcceleration(10000);
stepper.moveTo(200);
#endif // !CORE_MOCK
uint8_t mac[6];
WiFi.macAddress(mac);
......@@ -298,13 +304,14 @@ void loop()
}
// Stepper
#if !CORE_MOCK
if (stepper.distanceToGo() == 0)
{
stepper.moveTo(-stepper.currentPosition());
Serial.println("Rotating Motor in opposite direction...");
}
stepper.run();
#endif // !CORE_MOCK
webLoop();
dnsServer.processNextRequest(); // AP redirection
......
// 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment