mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-13 13:01:55 +03:00
Sphinx syntax fixes (#9180)
get rid of warnings when converting python -> rst, force quit when they happen fix code-blocks, always need extra line fix invalid headers refs so they actually work
This commit is contained in:
@ -40,7 +40,8 @@ To get events to work we need to complete just two steps:
|
||||
|
||||
1. Declare the event handler in global scope.
|
||||
|
||||
.. code:: cpp
|
||||
.. code-block:: cpp
|
||||
|
||||
WiFiEventHandler disconnectedEventHandler;
|
||||
|
||||
Alternatively, it can be declared as ``static`` in both function and global scopes.
|
||||
@ -49,7 +50,8 @@ Alternatively, it can be declared as ``static`` in both function and global scop
|
||||
2. Select particular event (in this case ``onStationModeDisconnected``).
|
||||
When this event is fired the code will print out information that station has been disconnected:
|
||||
|
||||
.. code:: cpp
|
||||
.. code-block:: cpp
|
||||
|
||||
disconnectedEventHandler = WiFi.onStationModeDisconnected(
|
||||
[](auto&& event) {
|
||||
Serial.println("Station disconnected");
|
||||
@ -57,7 +59,8 @@ Alternatively, it can be declared as ``static`` in both function and global scop
|
||||
|
||||
3. Disable ``disconnectedEventHandler``, so the event is no longer handled by our callback:
|
||||
|
||||
.. code:: cpp
|
||||
.. code-block:: cpp
|
||||
|
||||
disconnectedEventHandler = nullptr;
|
||||
|
||||
Take note that lifetime of the callback handler is up to the app. e.g. if ``onStationModeDisconnected`` is declared in the function scope, it would be discarded immediately after the function exits.
|
||||
@ -67,7 +70,7 @@ The Code
|
||||
|
||||
The complete code, including both methods discussed at the beginning, is provided below.
|
||||
|
||||
.. code:: cpp
|
||||
.. code-block:: cpp
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
|
||||
|
@ -16,7 +16,6 @@ Table of Contents
|
||||
- `The Page is Served <#the-page-is-served>`__
|
||||
- `Get it Together <#put-it-together>`__
|
||||
- `Get it Run <#get-it-run>`__
|
||||
- `What Else? <#what-else>`__
|
||||
- `Conclusion <#conclusion>`__
|
||||
|
||||
The Object
|
||||
|
Reference in New Issue
Block a user