Add AUTOCONNECT_NOUSE_JSON directive

pull/172/head
Hieromon Ikasamo 4 years ago
parent 8a925478e0
commit bd98d57db1
  1. 17
      mkdocs/faq.md
  2. 3
      mkdocs/wojson.md
  3. 2
      src/AutoConnectDefs.h

@ -147,6 +147,23 @@ HTTP port number is defined as a macro in [AutoConnectDefs.h](https://github.com
You can change both by using [AutoConnectConfig::apid](apiconfig.md#apid) and [AutoConnectConfig::psk](apiconfig.md#psk). Refer to section [Change SSID and Password for SoftAP](advancedusage.md#change-ssid-and-password-for-softap) in [Advanced usage](advancedusage.md).
## <i class="fa fa-question-circle"></i> How do I detach the ArdunoJson?
If you don't use ArduinoJson at all, you can detach it from the library. By detaching ArduinoJson, the binary size after compilation can be reduced. You can implement custom Web pages with your sketches without using ArduinoJson. Its method is described in [Custom Web pages w/o JSON](wojson.md).
To completely remove ArduinoJson at compile-time from the binary, you need to define a special `#define` directive for it. And if you define the directive, you will not be able to use the [OTA update with the update server](otaserver.md#updates-with-the-update-server) feature as well as AutoConnectAux described by JSON.
To exclude ArduinoJson at compile-time, give the following `#define` directive as a compiler option such as the [arduino-cli](https://github.com/arduino/arduino-cli) or [PlatformIO](https://platformio.org/).
```
#define AUTOCONNECT_NOUSE_JSON
```
For example, add the following description to the `[env]` section of the `platformio.ini` file with the `build-flags`.
```ini
build-flags = -DAUTOCONNECT_NOUSE_JSON
```
## <i class="fa fa-question-circle"></i> How erase the credentials saved in EEPROM?
Make some sketches for erasing the EEPROM area, or some erasing utility is needed. You can prepare the sketch to erase the saved credential with *AutoConnectCredential*. The *AutoConnectCrendential* class provides the access method to the saved credential in EEPROM and library source file is including it. Refer to '[Saved credential access](credit.md#saved-credential-in-eeprom)' on section [Appendix](credit.md) for details.

@ -28,6 +28,9 @@ In addition to the above procedure, to completely cut off for binding with the A
!!! caution "JSON processing will be disabled"
Commenting out the **AUTOCONNECT_USE_JSON** macro invalidates all functions related to JSON processing. If the sketch is using the JSON function, it will result in a compile error.
!!! hint "Exclude the ArduinoJson by each compile-time"
If you want to exclude ArduinoJson without changing the library code, specify the **AUTOCONNECT_NOUSE_JSON** directive as a compiler option according to the method described in the [FAQ](faq.md#how-do-i-detach-the-ardunojson).
## Implementation example without ArduinoJson
The code excluding JSON processing from the mqttRSSI sketch attached to the library is as follows. <small>(It is a part of code. Refer to mqttRSSI_NA.ino for the whole sketch.)</small>

@ -27,10 +27,12 @@
// Indicator to specify that AutoConnectAux handles elements with JSON.
// Comment out the AUTOCONNECT_USE_JSON macro to detach the ArduinoJson.
#ifndef AUTOCONNECT_NOUSE_JSON
#define AUTOCONNECT_USE_JSON
// Indicator of whether to use the AutoConnectUpdate feature.
#define AUTOCONNECT_USE_UPDATE
#endif
// Predefined parameters
// SSID that Captive portal started.

Loading…
Cancel
Save