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

reenabling wifi

parent 75a708dd
No related branches found
No related tags found
1 merge request!17Malaurie's work on UI + CLI interface + AccelStepper interface
...@@ -78,7 +78,6 @@ DNSServer dnsServer; ...@@ -78,7 +78,6 @@ DNSServer dnsServer;
char ssid[65]; char ssid[65];
Modes mode = Modes::RPM; Modes mode = Modes::RPM;
bool stepperMoving = false;
int move = 0; int move = 0;
...@@ -245,27 +244,10 @@ void buttons (int shortp, int longp) ...@@ -245,27 +244,10 @@ void buttons (int shortp, int longp)
#if !CORE_MOCK #if !CORE_MOCK
IRAM_ATTR
void stepperRunOLD ()
{
// if (syringe.locked())
// return;
// cli();
#if 0
if (rpming)
stepperMoving = stepper.runSpeed();
else
stepperMoving = stepper.run();
#else
stepperMoving = stepper.runSpeed();
#endif
// sei();
}
IRAM_ATTR IRAM_ATTR
void stepperRun () void stepperRun ()
{ {
stepperMoving = stepper.runSpeed(); stepper.runSpeed();
} }
#endif // !CORE_MOCK #endif // !CORE_MOCK
...@@ -299,12 +281,12 @@ void setup() ...@@ -299,12 +281,12 @@ void setup()
digitalWrite(SLEEP, 0); digitalWrite(SLEEP, 0);
#endif // !CORE_MOCK #endif // !CORE_MOCK
#if 0 #if 1
uint8_t mac[6]; uint8_t mac[6];
WiFi.macAddress(mac); WiFi.macAddress(mac);
sprintf(ssid, NAME "-%02x%02x%02x", mac[3], mac[4], mac[5]); sprintf(ssid, NAME "-%02x%02x%02x", mac[3], mac[4], mac[5]);
#if 0 #if 1
if (strlen(STASSID) > 0) if (strlen(STASSID) > 0)
{ {
WiFi.setPhyMode(WIFI_PHY_MODE_11G); WiFi.setPhyMode(WIFI_PHY_MODE_11G);
...@@ -346,7 +328,7 @@ void setup() ...@@ -346,7 +328,7 @@ void setup()
timer1_enable(TIM_DIV1, TIM_EDGE, TIM_LOOP); timer1_enable(TIM_DIV1, TIM_EDGE, TIM_LOOP);
timer1_attachInterrupt(stepperRun); timer1_attachInterrupt(stepperRun);
timer1_write(microsecondsToClockCycles(100)); timer1_write(microsecondsToClockCycles(100));
schedule_recurrent_function_us([](){ if (stepperMoving) { InterruptLock lock; stepper.computeNewSpeed(); } return true; }, 1); schedule_recurrent_function_us([](){ if (stepper.distanceToGo()) { InterruptLock lock; stepper.computeNewSpeed(); } return true; }, 1);
#else #else
#warning =================================================================================================== #warning ===================================================================================================
#warning "Please use the ISR version of AccelStepper (git clone -b isr https://github.com/d-a-v/AccelStepper)" #warning "Please use the ISR version of AccelStepper (git clone -b isr https://github.com/d-a-v/AccelStepper)"
...@@ -374,7 +356,10 @@ void setup() ...@@ -374,7 +356,10 @@ void setup()
void loop() void loop()
{ {
if (bEmergency.update(digitalRead(COURSE))) if (bEmergency.update(digitalRead(COURSE)))
syringe.manageEmergency(bEmergency.pressed(), stepperMoving); {
syringe.manageEmergency(bEmergency.pressed(), !!stepper.distanceToGo());
Serial.printf("%sEmergency=%u (remaining steps = %lu)\n", msgHeader, bEmergency.pressed(), stepper.distanceToGo());
}
#if CORE_MOCK #if CORE_MOCK
bool changeA = false; bool changeA = false;
...@@ -416,6 +401,6 @@ void loop() ...@@ -416,6 +401,6 @@ void loop()
} }
console.loop(Serial); console.loop(Serial);
//webLoop(); webLoop();
//dnsServer.processNextRequest(); // access-point redirection dnsServer.processNextRequest(); // access-point redirection
} }
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