Skip to content

ArduinoOTA - 'handle' quite expensive #10966

@dirkx

Description

@dirkx

Board

All

Device Description

All - with OTA enabled

Hardware Configuration

All, with OTA enabled

Version

latest master (checkout manually)

IDE Name

any

Operating System

any

Flash frequency

any

PSRAM enabled

yes

Upload speed

any

Description

ArduinoOTA requires a call to handle() in loop() for its house keeping. With the salient parts:

void ArduinoOTAClass::handle() {
    ......
    if(_udp_ota.parsePacket())
        _onRx();
    _udp_ota.flush(); // always flush, even zero length packets must be flushed.
}

it appears that always doing a flush is relatively expensive; i.e. it takes 50-80 microseconds even when there is no packet seen. May be good to only do this when parsePacket() actually sees a packet (even if it is zerolenght or corrupted packet). Or move the flush into the exit routing of parsePacket().

Sketch

#include <ArduinoOTA.h>
void setup() {
   ArduinoOTA.begin();
}
void loop() {
  ArduinoOTA.handle();
}

Debug Message

na

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions