mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[Arduino IDE] Document how to build using Custom.h in Arduino IDE
See: [forum](https://www.letscontrolit.com/forum/viewtopic.php?f=4&t=7980)
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
Arduino IDE
|
||||
***********
|
||||
|
||||
The preferred way to build ESPEasy is using PlatformIO.
|
||||
However, there are still lots of people happily using Arduino IDE.
|
||||
Therefore we try to keep the project source compatible with Arduino IDE.
|
||||
|
||||
Since development is not done in Arduino IDE, it may happen that some commit breaks Arduino IDE compatibility.
|
||||
Usually it is something as simple as an include not being relative compared to the file which is being compiled.
|
||||
This is a bug, which PlatformIO does not complain about and thus can be missed easily during development.
|
||||
|
||||
If something like this happens, please open an issue (or pull request) for it on GitHub.
|
||||
Also, if someone knows a build flag for PlatformIO to signal those errors, please let us know.
|
||||
|
||||
|
||||
Prepare Arduino IDE
|
||||
===================
|
||||
|
||||
When installing Arduino IDE, its default installation folder structure is to share libraries and sketches among all installations of Arduino IDE.
|
||||
If you only build one project, this is just fine.
|
||||
However, if you try to build several projects or versions of projects, then you will run into library dependency issues.
|
||||
|
||||
See: `how to create portable version of Arduino IDE <https://www.arduino.cc/en/Guide/PortableIDE>`_
|
||||
|
||||
For building ESPEasy it is adviced to use a "portable installation" of Arduino IDE.
|
||||
|
||||
|
||||
Arduino IDE Prerequisites
|
||||
=========================
|
||||
|
||||
For building ESPEasy in Arduino IDE, you need to install the board manager and ESP8266/ESP32 library.
|
||||
|
||||
See these excellent tutorials:
|
||||
|
||||
* `How to install ESP8266 board for Arduino IDE <https://randomnerdtutorials.com/how-to-install-esp8266-board-arduino-ide/>`_
|
||||
* `How to install ESP32 board for Arduino IDE <https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/>`_
|
||||
|
||||
|
||||
Download ESPEasy Sources
|
||||
========================
|
||||
|
||||
The sources can be downloaded from `GitHub <https://github.com/letscontrolit/ESPEasy>`_ as ZIP file.
|
||||
|
||||
In this document, the given file system paths refer to a portable installation of Arduino IDE in ``D:\temp\Arduino-EspEasy\``
|
||||
|
||||
The structure in the ZIP file are made for use in PlatformIO.
|
||||
To use the source in Arduino IDE, you have to split the sources into 2 parts:
|
||||
|
||||
* The used libraries: ``D:\temp\Arduino-EspEasy\portable\sketchbook\libraries``
|
||||
* The source code: ``D:\temp\Arduino-EspEasy\portable\sketchbook\ESPEasy``
|
||||
|
||||
Some used libraries differ from the original ones to make them work with ESPEasy.
|
||||
So make sure to use the ones supplied in the ZIP file in the ``lib`` folder.
|
||||
If some libraries are missing from the ``lib`` folder, you can install them via the Arduino IDE library manager.
|
||||
|
||||
The source code files to be placed in the ``ESPEasy`` directory must be taken from the (first) ``src`` directory in the ZIP file.
|
||||
Meaning the file ``ESPEasy.ino`` must be in the ``ESPEasy`` folder. (including all files in sub folders)
|
||||
|
||||
|
||||
Building using Custom.h
|
||||
=======================
|
||||
|
||||
There is a ``Custom-sample.h`` file supplied, which has lots of defines that can be set or uncommented to make a specific build
|
||||
including just the plugins and controllers needed and maybe even some proper default settings.
|
||||
|
||||
To use this file, it must be renamed to ``Custom.h``.
|
||||
PlatformIO does recognize the presence of this file when building a ``Custom`` build environment.
|
||||
But for Arduino IDE, a single line must be uncommented in ``ESPEasy_common.h``
|
||||
|
||||
Make sure to uncomment this line at the start of ``ESPEasy_common.h``: ``//#define USE_CUSTOM_H``
|
||||
This define makes sure the ``Custom.h`` file is actually included during build.
|
||||
|
||||
|
||||
Board definitions
|
||||
=================
|
||||
|
||||
In Arduino IDE you must prepare the environment variables yourself.
|
||||
|
||||
.. image:: ArduinoIDEBoardConfig.png
|
||||
|
||||
* Board: "Generic ESP8266 Module"
|
||||
* Flash Size: Pick the one reflecting your board (4M flash 1M FS is the most used)
|
||||
* Flash Mode: "DOUT"
|
||||
|
||||
The other settings are likely to be correct when using the defaults.
|
||||
See the screenshot to be sure.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
@@ -30,6 +30,7 @@ Welcome to ESP Easy's documentation!
|
||||
:caption: Appendix
|
||||
|
||||
Participate/PlatformIO.rst
|
||||
Participate/ArduinoIDE.rst
|
||||
Participate/Documentation.rst
|
||||
Participate/ProjectStructure.rst
|
||||
Reference/Safety.rst
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
#pragma GCC diagnostic warning "-Wall"
|
||||
#endif
|
||||
|
||||
// Include this as first, to make sure all defines are active during the entire compile.
|
||||
// See: https://www.letscontrolit.com/forum/viewtopic.php?f=4&t=7980
|
||||
// If Custom.h build from Arduino IDE is needed, uncomment #define USE_CUSTOM_H in ESPEasy_common.h
|
||||
#include "ESPEasy_common.h"
|
||||
|
||||
// Needed due to preprocessor issues.
|
||||
#ifdef PLUGIN_SET_GENERIC_ESP32
|
||||
#ifndef ESP32
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
#ifndef ESPEASY_COMMON_H
|
||||
#define ESPEASY_COMMON_H
|
||||
|
||||
// *****************************************************************************************
|
||||
// For Arduino IDE users:
|
||||
// When building using Custom.h, uncomment the next line:
|
||||
//#define USE_CUSTOM_H
|
||||
// *****************************************************************************************
|
||||
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
namespace std
|
||||
{
|
||||
@@ -12,14 +20,13 @@ namespace std
|
||||
#include <Arduino.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "src/Globals/RamTracker.h"
|
||||
|
||||
// User configuration
|
||||
// Include Custom.h before ESPEasyDefaults.h.
|
||||
#ifdef USE_CUSTOM_H
|
||||
#include "Custom.h"
|
||||
#endif
|
||||
|
||||
#include "src/Globals/RamTracker.h"
|
||||
#include "src/DataStructs/ESPEasyDefaults.h"
|
||||
|
||||
#ifdef USE_LITTLEFS
|
||||
|
||||
Reference in New Issue
Block a user