Open zshivers opened 2 days ago
It appears to take about ~300 ms to call one RPC over WiFi. I'm using an Adafruit ESP32-S2 TFT Feather board.
Arduino code:
#include <WiFi.h> #include <simpleRPC.h> #define SSID "..." #define PASS "..." #define PORT 1025 WiFiServer server(PORT); void setup() { WiFi.begin(SSID, PASS); while (WiFi.status() != WL_CONNECTED) { delay(500); } server.begin(); } void loop() { WiFiClient client{ server.available() }; if (client) { while (client.connected()) { interface( client, millis, F("millis: Get time in milliseconds. @return: Timestamp in milliseconds")); } client.stop(); } }
Using a quick script to query millis() continuously:
millis()
from simple_rpc import Interface with Interface('socket://REPLACE_IP:1025') as interface: last_millis = 0 while True: millis = interface.millis() if last_millis > 0: print(millis - last_millis) last_millis = millis
results in approximately 300 ms between timestamps from the Arduino:
% python3 rpc_test.py 322 318 321 347 345 328 316 326 327 324 346 ...
Trying something similar using Serial instead of WiFiClient as the Stream interface for the RPC results 0-1 ms between calls. Is there something that can be done to improve the latency?
Serial
WiFiClient
Stream
I think this may be related to this issue. Perhaps you can try the suggestion made there?
It appears to take about ~300 ms to call one RPC over WiFi. I'm using an Adafruit ESP32-S2 TFT Feather board.
Arduino code:
Using a quick script to query
millis()
continuously:results in approximately 300 ms between timestamps from the Arduino:
Trying something similar using
Serial
instead ofWiFiClient
as theStream
interface for the RPC results 0-1 ms between calls. Is there something that can be done to improve the latency?