1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

8 Commits

Author SHA1 Message Date
david gauchard
5d60c55fb2
emulation on host: missing mock functions, improve host interface handling (#7404) 2020-06-24 19:05:57 +02:00
Dirk O. Kaar
6cb16997d8
Use F_CPU if (?) CPU frequency switch is compile-time only (#6833)
* At least the F_CPU define in host mock.h is needed by host Arduino.h - need to include Arduino.h further down in mock.h for this to work.

* Geting the include order right

* Prepare for runtime CPU clock rate selection

* Fix compile for not defined F_CPU

If defined F_CPU, make getCpuFreqMHz() a constexpr

* Use defines for register CPU2X instead of hex value

* Fix build for host - getCpuFreqMHz there was also in conflict with getCycleCount, using F_CPU:

tests/host/common/mock.h:#define F_CPU 80000000 (!)

* Asymmetrical includes and defines on host

* Support restart switch from 160MHz to 80MHz, e.g for OTA. Fixes #579
2020-04-15 16:15:35 -04:00
Dirk O. Kaar
7ab1f615ac F_CPU is available and is 80000000 (#6841) 2019-11-26 10:32:13 -07:00
Earle F. Philhower, III
7036297920 Convert ESP8266WebServer* into templatized model (#5982)
* Convert ESP8266WebServer* into templatized model

Supercedes #4912

Refactor the three versions of ESP8266WebServer and *WebServerSecure to a
single templated class. Use "using" to enable old, non-templated names to b
used (so no user changes required to compile or run).

Fixes #4908 and clean up the code base a lot.

Basic tests run (the ones in the example code).

No code changes are required in userland except for setting the SSL
certificates which now use a cleaner "getServer()" accessor and lets the
app use the native BearSSL calls on the WiFiClientSecure object.

@devyte should be proud, it removes virtuals and even has template specialization...

* Fix HTTPUpdate templates and examples

* Fix HTTPUpdateServer library build

Need to remove dot-a linkage since there are no .cpp files in the
directory anymore due to templates.

* Provide backward-compat names for updt template

Allow existing code to use the same well known names for
HTTPUpdateSecure.

* Remove ClientType from all templates, auto-infer

Remove the ClientType template parameter from all objects.  Simplifies
the code and makes it more foolproof.

Add a "using" in each server to define the type of connection returned
by all servers, which is then used in the above templates automatically.

* Can safely include FS.h now that SD/SPIFFS unified

* Move the templates/objects to their own namespaces

* Fix merge issues with untemplated methods

* Address review comments

* Fix mock test, remove warnings inside test dir

Make the simple mock test CI job pass and clean up
any spurious warnings in the test directory.

There still are warnings in the libraries and core, but they
should be addressed in a separate PR.
2019-07-04 10:58:22 +02:00
david gauchard
9a2ed274f3 polledTimeout: add option to use CPU count instead of millis() (#5870)
* polledTimeout: add option to use CPU count instead of millis()

* use more "using" alias

* more c++/clear code, using typename (thanks @devyte)

* rename class name to include unit, introduce timeMax() and check it with assert()

* remove useless defines

* improve api readability, add micro-second unit

* update example

* mock: emulate getCycleCount, add/fix polledTimeout CI test

* + nano-seconds, assert -> message, comments, host test

* allow 0 for timeout (enables immediate timeout, fix division by 0)

* typo, set member instead of local variable

* unify error message

* slight change on checkExpired() allows "never expired"
also removed printed message, add YieldAndDelay, simplify calculations

* remove traces of debug.h/cpp in this PR

* include missing <limits> header

* back to original expired test, introduce boolean _neverExpires, fix reset(), getTimeout() is invalid

* fix expiredOneShot with _timeout==0 check

* reenable getTimeout()

* expose checkExpired with unit conversion

* fix timing comments, move critical code to iram

* add member ::neverExpires and use it where relevant

* improve clarity

* remove exposed checkExpired(), adapt LEAmDNS with equivalent

* add API ::resetToNeverExpires(), use it in LEAmDNS

* remove offending constness from ::flagged() LEAmDNS (due do API fix in PolledTimeout)

* simplify "Fast" base classes

* minor variable rename

* Fix examples

* compliance with good c++ manners

* minor changes for consistency

* add missing const

* expired() and bool() moved to iram

* constexpr compensation computing

* add/update comments

* move neverExpires and alwaysExpired
2019-04-05 10:50:53 -03:00
david gauchard
61a8a6b14e
emulation on host: fix nasty delay (#5840)
emulation with socket: fix nasty delay
        properly check all return values (read() returning 0 indicates closed peer)
        ClientContext::state() triggers read() to check for closed peer

uart emulation on tty: add cmdline -b debug option to disable raw tty

hide annoying MOCK messages, add cmdline -v option to show them

uart emulation on tty: check more return values

emulation on host: tcp/udp port shifting: new cmdline -s(port Shift) option
2019-03-05 16:59:39 +01:00
Clemens Kirchgatterer
9ba89ebaf4 emulation on host: Add missing ESP.*() mocking methods to EspClass. (#5765) 2019-02-16 00:05:18 +01:00
david gauchard
74ca42f829 Sketch emulation on host (#5342)
* WIP compile examples on host with 'make examples'

* WIP bufferize tcp input

* WIP Makefile

* WIP network to rework, tcp/udp to factorize, udp addresses broken

* minor changes to the core

* WIP basic udp working

* WIP mdns

* WIP mcast receiving, not sending

* WIP mdns OK

* beta version

* SSL + doc

* update travis host test command

* licenses

* typo

* doc: arduino builder is not around: declare functions before calling them

* fix with latest SSL PR, compile in 32 bits mode

* fix make clean

* make -m32 optional

* 32bits compiler ability tester

* WIP

* WIP (fix 1 vtable error, still another one to hunt with using spiffs)

* example astyle

* fix os_printf_plus

* load / save mock spiffs

* fix style

* fix using spiffs/mock

* don't mess ram

* update doc

* remove leftover

* optimization -Os except for CI, rename ARCH32 to FORCE32

* revert useless cast (not even compiled)

* remove unused function

* use proper type for pointer arithmetics

* makefile: sketch object and cpp file moved to bin/ directories
easier to clean, and IDE don't like them

* changes for review

* make use of %zd

* less verbose makefile by default (option)

* update readme
2018-11-20 18:51:45 -02:00