Skip to content

Servo lib has 15ms delay since ESP8266 V3.0.0 #8081

Closed
@makerobotics

Description

@makerobotics

Basic Infos

  • [x ] This issue complies with the issue POLICY doc.
  • [x ] I have read the documentation at readthedocs and the issue is not addressed there.
  • [x ] I have tested that the issue is present in current master branch (aka latest git).
  • [x ] I have searched the issue tracker for a similar issue.
  • [x ] I have filled out all fields below.

Platform

  • Hardware: [ESP8266]
  • Core Version: [3.0.0]
  • Development Env: [Arduino IDE]
  • Operating System: [Ubuntu]

Settings in IDE

  • Module: [Wemos D1 mini r2]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

I am programming a useless box with a Wemos D1 mini.
I use a servo : "myservo.write(pos); "
Since the board update to V3.0.0, there is a delay in the servo write instruction (15ms as I could trace).
If I go back to a later board version, this problem is no more present. The servo lib version is not changing anything.

MCVE Sketch

#include <Arduino.h>
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
unsigned long timestamps[4];

void scenarioStepMoveToContact(int delayscenarioStep){
//  timestamps[0] = millis();
  pos--;
  //Serial.println(pos);
//  timestamps[1] = millis();
  myservo.write(pos);                 // tell servo to go to position in variable 'pos'
//  timestamps[2] = millis();
  delay(delayscenarioStep);
  if(!isPushed()){
    Serial.println("Reached contact");
    scenarioStep++;
    btnLock = 0; // unlock next cycle
    Serial.println("unlock");
  }
  /* Safety */
  else if(pos<ENDPOS){
    Serial.println("Reached end position");
    btnLock = 0; // unlock next cycle [DEBUG]
    Serial.println("Unlock");
    scenarioStep++;
  }
//  timestamps[3] = millis();
}

void setup() {
  myservo.attach(SERVO);        // attaches the servo on GIOxx to the servo object
  myservo.write(SERVO_STANDBY); // start servo at STANDBY deg

}

void loop() {
  // this is not the real code, but enough to understand the example...
  scenarioStepMoveToContact(5);
}

Time between the timestamps is 15ms as I use the V3.0.0 board.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions