Skip to content
Snippets Groups Projects
Commit b92e0552 authored by David Gauchard's avatar David Gauchard
Browse files

make emu on host work again

parent ed8b1816
No related branches found
No related tags found
1 merge request!17Malaurie's work on UI + CLI interface + AccelStepper interface
......@@ -6,7 +6,7 @@ firefox=true
pwd=$(pwd)
cd ${ESP8266ARDUINO}/tests/host
make FORCE32=0 ssl
make -j 10 FORCE32=0 USERCFLAGS="-I ${ARDUINOLIB}/emuAsync/replacement" ULIBDIRS=${ARDUINOLIB}/emuAsync:${ARDUINOLIB}/ESPUI:${ARDUINOLIB}/ArduinoJson:${ARDUINOLIB}/arduinoWebSockets ${pwd}/../pousseseringue-arduino
make -j 10 FORCE32=0 USERCFLAGS="-I ${ARDUINOLIB}/emuAsync/replacement" ULIBDIRS=${ARDUINOLIB}/emuAsync:${ARDUINOLIB}/ESPUI:${ARDUINOLIB}/ArduinoJson:${ARDUINOLIB}/arduinoWebSockets:${ARDUINOLIB}/ESPWebDAV:${ARDUINOLIB}/Debouncer ${pwd}/../pousseseringue-arduino
$firefox && (
true '----------------------------------------'
......
......@@ -8,17 +8,25 @@
#if CORE_MOCK
class AccelStepper
{
public:
enum { DRIVER, FULL4WIRE, };
AccelStepper(uint8_t interface = AccelStepper::FULL4WIRE, uint8_t pin1 = 2, uint8_t pin2 = 3, uint8_t pin3 = 4, uint8_t pin4 = 5, bool enable = true) {}
unsigned long computeNewSpeed () { return 10; }
float maxSpeed () { return 10; }
float acceleration () { return 5; }
long distanceToGo () { return 0; }
};
#else
#include <AccelStepper.h>
#endif
class isrStepper: public AccelStepper
class ISRStepper: public AccelStepper
{
// usefulness: make computeNewSpeed() public to be called outside from interrupt
public:
isrStepper(uint8_t interface = AccelStepper::FULL4WIRE, uint8_t pin1 = 2, uint8_t pin2 = 3, uint8_t pin3 = 4, uint8_t pin4 = 5, bool enable = true):
ISRStepper(uint8_t interface = AccelStepper::FULL4WIRE, uint8_t pin1 = 2, uint8_t pin2 = 3, uint8_t pin3 = 4, uint8_t pin4 = 5, bool enable = true):
AccelStepper(interface, pin1, pin2, pin3, pin4, enable) { }
// make it public
inline unsigned long computeNewSpeed () { return AccelStepper::computeNewSpeed(); }
};
......@@ -26,9 +34,9 @@ class Motor
{
public:
using MotorHardware_t = isrStepper;
using MotorHardware_t = ISRStepper;
Motor (isrStepper& stepper): stepper(stepper)
Motor (MotorHardware_t& stepper): stepper(stepper)
{
setSpeedMmPerSec(1);
setAccelMmPerSecPerSec(0.5); // <----- this is not yet configured by user
......@@ -63,7 +71,6 @@ public:
void setSpeedMmPerSec (float mmPerSec)
{
Serial.printf("# set speed to %g steps/s\n", mmToStep(mmPerSec));
#if !CORE_MOCK
stepper.setMaxSpeed(mmToStep(mmPerSec));
#endif
......@@ -177,5 +184,5 @@ protected:
float _retainAccel = -1;
bool _forwardClockwise;
isrStepper& stepper;
MotorHardware_t& stepper;
};
......@@ -6,12 +6,15 @@
#undef STASSID
#undef STAPSK
#define STASSID "hackaton"
#define STAPSK "WifiLAAS2018"
#ifndef STASSID
#define STASSID "laas-capture"
#define STAPSK ""
#endif
#ifndef ARDUINO_ESP8266_ADAFRUIT_HUZZAH
#if !CORE_MOCK && !defined(ARDUINO_ESP8266_ADAFRUIT_HUZZAH)
#error select board Adafruit Feather HUZZAH ESP8266
#endif
......@@ -43,6 +46,7 @@
#include <Schedule.h>
#include <interrupts.h> // InterruptLock
using InterruptLock = esp8266::InterruptLock;
#if !CORE_MOCK
......@@ -50,21 +54,15 @@ using InterruptLock = esp8266::InterruptLock;
SSD1306AsciiWire oled;
#endif // !CORE_MOCK
#include "motor.h"
#if CORE_MOCK
isrStepper stepper;
#else
isrStepper stepper(AccelStepper::DRIVER, STEP, DIR);
#endif
#include "Debouncer.h" // local, debouncer, short counter, long detector
#include "syringe.h"
#include "cli.h"
#include "common.h"
#include "fs.h"
ISRStepper stepper(AccelStepper::DRIVER, STEP, DIR);
enum class Modes { TURN, TURNSetup, RPM, RPMSetup, INFO };
const char* msgHeader = MSGHEADER;
......
......@@ -8,4 +8,5 @@
#include "syringe.cpp"
#include "motor.cpp"
#include "cli.cpp"
#include "fs.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