Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functioning web server to pilot a GPO #29

Open
wants to merge 188 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
3e19813
Added instructables tutorial for AC Relay control w/ Arduino
Clovel Aug 29, 2019
6b47a00
Added ressource links in README.md
Clovel Aug 29, 2019
48a6463
Added research file on ESPs
Clovel Aug 29, 2019
4170ac5
Changed name of project in README.md
Clovel Aug 29, 2019
37d08e9
Added example 1 code & link to SO question
Clovel Aug 29, 2019
ec783e0
Merge branch 'README' into dev
Clovel Aug 29, 2019
d267952
Added link to Arduino forums explaining 3.3V/5V Power supply on NodeMCU
Clovel Aug 29, 2019
4e990cf
Added photos of notes/drawings for elec & meca
Clovel Aug 29, 2019
cf4d0dd
Updated .gitignore
Clovel Aug 29, 2019
0806335
Added link to tutorial for a smart plug w/ ESP8266
Clovel Aug 30, 2019
d362561
Uncrustified example1
Clovel Aug 30, 2019
765927d
Updated .gitignore to ignore web-example binary files
Clovel Sep 3, 2019
f6b8d1d
Added web-example : Change variable value w/ REST API in C/C++
Clovel Sep 3, 2019
28556b2
Fixed typo in main home string
Clovel Sep 4, 2019
677a35e
Added htmlSend functions
Clovel Sep 4, 2019
6877109
Close the client after having sent the info to the client
Clovel Sep 4, 2019
8213831
Now using htmlSend + reordered functions in remoteRequest
Clovel Sep 4, 2019
c142fe8
Peudo support for other RESTful requests
Clovel Sep 4, 2019
b9746b5
Renamed "not_found" to "notFound"
Clovel Sep 4, 2019
dfaefbf
Updated HTML strings
Clovel Sep 4, 2019
a044606
Close client when exiting acceptRequest
Clovel Sep 4, 2019
3624c13
Updated acceptRequest function
Clovel Sep 4, 2019
b342e7b
Fixed refactor error
Clovel Sep 4, 2019
38cf4fc
Added makefile to build web-example
Clovel Sep 4, 2019
cab37df
Merge branch 'web-example' into research
Clovel Sep 4, 2019
35536bd
Merge branch 'dev' into research
Clovel Sep 4, 2019
d943087
Merge pull request #2 from Clovel/research
Clovel Sep 4, 2019
4bec6a1
Added list of contributors to README.md
Clovel Sep 4, 2019
9f4bec9
Merge pull request #5 from Clovel/contributors
Clovel Sep 4, 2019
ac10023
Hotfix of the list of contributors
Clovel Sep 4, 2019
19915bf
Hotfix merge pull request #5 from Clovel/contributors
Clovel Sep 4, 2019
06d8bc3
Added warning flags in Makefile for web-example
Clovel Sep 4, 2019
f2f2a43
[#6][WIP]
Clovel Sep 4, 2019
b6cf486
[#6] Added Relay class
Clovel Oct 20, 2019
d30b348
[#6] Added file to store webpage snippets
Clovel Oct 20, 2019
ca43d1a
[#6] Updated web-example to have a working post example.
Clovel Oct 20, 2019
1bcfb1f
[#6] Fixed log
Clovel Oct 21, 2019
94d0dfe
[#7] Parse errno in main.cxx
Clovel Oct 21, 2019
e3d3ced
[#7] Get errors of htmlSend and print it
Clovel Oct 21, 2019
0abd2d1
[#6] Cleanup of remoteRequest
Clovel Oct 21, 2019
5580c39
[#6, #7] Cleanup of web-example + usage of errno
Clovel Oct 21, 2019
38137e9
Merge branch 'web-example-errno' into web-example
Clovel Nov 7, 2019
0b31054
[#6] Corrected header comment of remoteRequest.hxx
Clovel Nov 7, 2019
11693ab
[#6] Corrected header comment of remoteRequest.cxx
Clovel Nov 7, 2019
3bf7070
[#6] Reworked getLine from socket function
Clovel Nov 7, 2019
234e21c
[#6] Set server socket options to reuse address & port
Clovel Nov 7, 2019
f6d8fcb
[#6] Set the client socket as non-blocking
Clovel Nov 7, 2019
fd98568
[#6] Print a newline at the end of the main loop to separate request …
Clovel Nov 7, 2019
3c7879c
[#6] Cleaned up prints
Clovel Nov 7, 2019
70c4ba0
[#6] Updated HTML string
Clovel Nov 7, 2019
936d3a3
[#6] Added a class to parse and hold HTTP request data
Clovel Nov 7, 2019
19c0376
[#6] Using HttpRequest class in acceptRequest
Clovel Nov 7, 2019
dfc6709
[#6] Sleep 10ms before/after accepting request to give the client som…
Clovel Nov 7, 2019
771266c
[#6] Cleanup of warnings & comments
Clovel Nov 7, 2019
11162a9
[#6] Added/updated example HTML code
Clovel Nov 7, 2019
7d4dd9e
Merge pull request #8 from Clovel/web-example
Clovel Nov 7, 2019
69928e5
Added useful links to other examples
Clovel Nov 7, 2019
79d36b5
Update README.md
Clovel Nov 7, 2019
f1bb270
Added link to Simon Pavy's account in README.md
simon44530 Nov 9, 2019
fee2789
Merge pull request #11 from Clovel/README
Clovel Nov 9, 2019
032fff0
[#9] Initiated the PlatformIO IDE project with the project .ini file
Clovel Nov 20, 2019
02766af
[#9] Updated .gitignore for PIO files
Clovel Nov 20, 2019
17a8777
[#9] First blink example w/ NodeMCU
Clovel Nov 20, 2019
e17eddd
Merge pull request #17 from Clovel/init_project
Clovel Nov 22, 2019
ef8e205
[#13] Started Relay class UTs
Clovel Nov 20, 2019
b65b5b8
Added default UT case
Clovel Nov 22, 2019
78b83c5
[#13] Renamed test files : .Xxx => .Xpp
Clovel Nov 22, 2019
51da6d5
[#13] Fixed compilation errors
Clovel Nov 22, 2019
a4726bd
[#13] Fixed Relay class to compile during tests
Clovel Nov 22, 2019
dc5d47e
Merge pull request #18 from Clovel/tests
Clovel Nov 22, 2019
57a5797
[#9, #15] Added main CMakeLists.txt file
Clovel Nov 22, 2019
558fb1a
[#9, #15, #16] Added CMakeLists.txt for Doxygen
Clovel Nov 22, 2019
dbf3b9e
[#9, #13] Added CMakeLists.txt for the tests
Clovel Nov 22, 2019
fa8911c
Cleaned up tests/CMakeLists.txt
Clovel Nov 22, 2019
9ac08f5
[#9] Removed ENABLE_DOCS & ENABLE_TESTS from main CMakeLists.txt
Clovel Nov 22, 2019
5af8be0
[#10, #13] Added BP for tests
Clovel Nov 22, 2019
a76546b
[#10, #13] Updated CTest workdir in test BP
Clovel Nov 22, 2019
cf5a73d
[#10] Install Doxygen in test BP
Clovel Nov 22, 2019
5d05e70
[#10] Install dot (graphviz) in test BP
Clovel Nov 22, 2019
15b07a0
[#10] No upgrade + corrected CTest workdir in test BP
Clovel Nov 22, 2019
e07251c
Merge pull request #19 from Clovel/cmake
Clovel Nov 22, 2019
bf67b3b
Merge pull request #20 from Clovel/test-bp
Clovel Nov 22, 2019
eb0ab62
[#10] Added BP for PlatformIO project
Clovel Nov 22, 2019
b547931
[#10] Corrected name for the main BP
Clovel Nov 22, 2019
8d8d413
Merge pull request #21 from Clovel/main-BP
Clovel Nov 22, 2019
cab9d15
Added build flags for debugging to project file
Clovel Nov 22, 2019
11893c4
Fixed Relay class
Clovel Nov 22, 2019
92d3583
Now using the Relay class to pilot the GPI
Clovel Nov 22, 2019
9da0eef
Updated mock functions in test_main.cpp
Clovel Nov 25, 2019
84f521d
Updated Relay class impl. for UTs
Clovel Nov 25, 2019
6654903
Merge pull request #23 from Clovel/use_relay
Clovel Nov 26, 2019
16a4bab
[#22, WIP] First attept to control relay w/ a switch
Clovel Nov 25, 2019
bbbc63c
[#16] Removed copyright, added Doxygen comments & beautyfied code
Clovel Nov 25, 2019
5d88f4c
Added common header for the elec namespace
Clovel Nov 26, 2019
e9d61e0
Added missing EOF newlines in the Relay class files
Clovel Nov 26, 2019
79b94dc
[#22] Added Switch class
Clovel Nov 26, 2019
9b1a323
[#22] Fixed compilation error in Switch.cpp
Clovel Nov 26, 2019
0ea2bf2
[#22] Use of Switch class in main program
Clovel Nov 26, 2019
c024a96
[#22] Fixed digitalRead prototype for UTs
Clovel Nov 26, 2019
e9efca0
[#22] Added digitalRead mock function in UTs
Clovel Nov 26, 2019
9210b43
Updated .gitignore for generated Doxyfile
Clovel Dec 4, 2019
154ccfa
Added trailing EoF newlines
Clovel Dec 4, 2019
4b7bff6
Fixed a mock function in tests to avoid a warning
Clovel Dec 4, 2019
9311a82
[#22] Use of defines + removed redundant pinMode call
Clovel Dec 9, 2019
e4db210
[#22] Success : We can now control the Relay w/ a physical switch
Clovel Dec 11, 2019
2a1f115
[#22] Corrected Relay::switchState prints for UTs
Clovel Dec 12, 2019
6956091
Merge pull request #24 from Clovel/use_switch
Clovel Dec 12, 2019
ec57948
Added libdeps to .gitignore
Clovel Dec 11, 2019
c1d355b
[#14] Added interactive AP w/ WiFiManager
Clovel Dec 11, 2019
e51ab55
[#14] Install WiFiManager lib in CI
Clovel Dec 12, 2019
77d54dc
[#14] Added link to a GPIO webserver example
Clovel Dec 12, 2019
3830d86
[#14] Added Relay::stringState to print on the web page
Clovel Dec 12, 2019
f1ee69d
[#14] Added web server to main.cpp
Clovel Dec 12, 2019
e9e3c35
[#14] Manage incoming client requests
Clovel Dec 12, 2019
1cd1066
[#14] Added remoteRequest.Xxx code as webtools.Xpp
Clovel Dec 12, 2019
46c1d71
[#14] Corrected header comments for webtools.Xpp
Clovel Dec 12, 2019
7273ae6
[#14] Updated htmlSend to use WiFiClient as arg
Clovel Dec 12, 2019
1d1d76c
[#14] Imported the HttpRequest class from webexample
Clovel Dec 12, 2019
3afbc3e
[#14, WIP] Started updating webtools.c includes
Clovel Dec 12, 2019
4855225
[#14] Updated webtools::getLine to use WiFiClient & Serial.print
Clovel Dec 12, 2019
f94fd95
[#14] Updated function prototypes in webtools to use WiFiClient
Clovel Dec 12, 2019
bc9e19a
Added missing EoF newline in webtools
Clovel Dec 12, 2019
4ab5fb6
Added static variable section in main.cpp
Clovel Dec 12, 2019
b3d2ce3
[#14] Removed use of errno in webtools::cat
Clovel Dec 12, 2019
7c5c342
Update README.md
Clovel Dec 12, 2019
61f8417
Set baudrate to 115200 in project config file
Clovel Dec 12, 2019
5d89850
[#14] Added WiFi callbacks for WiFiManager
Clovel Dec 12, 2019
bc027f3
[#14] Updated HttpRequest class for the ESP8266
Clovel Dec 12, 2019
95d568b
[#14] Updated webtools for the ESP8266
Clovel Dec 12, 2019
ebcbb9f
[#14] Updated main.cpp to use WiFi callback & webtools
Clovel Dec 12, 2019
59d03f8
Added missing EoF newline for HttpRequest.hpp
Clovel Dec 12, 2019
6793073
[#14] Added test function w/ code taken from an example online
Clovel Dec 12, 2019
7662efa
Corrected acceptRequest description comment
Clovel Dec 12, 2019
8d771b6
Remove FS.h include from main.cpp (for now ?)
Clovel Dec 12, 2019
9e4345b
[#14] Updated main.cpp to use testAccept
Clovel Dec 12, 2019
1d7a6c6
Added def.h to contain general defines, settings & definitions
Clovel Dec 13, 2019
ff8fd9b
Updated .gitignore
Clovel Dec 13, 2019
bb02f11
Use of def.h in main.cpp
Clovel Dec 13, 2019
04e32aa
Corrected missing header guards
Clovel Dec 13, 2019
ca9c827
[#26] Added Logger.hpp
Clovel Dec 12, 2019
83495d3
Added def.h to contain general defines, settings & definitions
Clovel Dec 13, 2019
a66c45c
[#26] Added Logger class definition
Clovel Dec 13, 2019
83d230b
[#26] Implemented Logger class
Clovel Dec 13, 2019
19ebee3
[#26] Got working Logger class (tested w/ std::cout)
Clovel Dec 13, 2019
8540c77
[#26] Example program to use Logger class w/ std::cout
Clovel Dec 13, 2019
258752c
Corrected missing header guard for def.h
Clovel Dec 13, 2019
e030e41
Added target defines in platformio.ini
Clovel Dec 20, 2019
ed7e4c6
Added target defines in CMakeLists.txt
Clovel Dec 20, 2019
64eab7d
[#26] Updated #ifdef section in Logger class
Clovel Jan 10, 2020
19ef198
[#26] Fixed usage of the print function in Logger class impl
Clovel Jan 10, 2020
273e769
Merge branch 'dev' into WiFiManager
Clovel Jan 10, 2020
4cd060a
Merge pull request #27 from Clovel/Logger
Clovel Jan 10, 2020
34bc24b
Merge branch 'dev' into WiFiManager
Clovel Jan 10, 2020
0c20d1b
Updated project to use Logger
Clovel Feb 2, 2020
ab7ec62
Renamed Logger variable in logger_example
Clovel Feb 2, 2020
185aef0
Added webpage files to define HTML contents
Clovel Feb 2, 2020
756f2e0
Updated webtools to use the webpage.cpp strings
Clovel Feb 2, 2020
1ca602a
Added serial port read command in a notes files
Clovel Feb 2, 2020
ce95483
Removed useless include in HttpRequest.cpp
Clovel Feb 2, 2020
0704a5f
Use of std::string::find instead of String::indefOf in webtools.cpp
Clovel Feb 2, 2020
d2c342d
Removed useless headers from webpage.hpp/cpp
Clovel Feb 2, 2020
b2f0b50
Updated Httprequest split function
Clovel Feb 3, 2020
48e6e1a
Added compilation flags in platformio.ini
Clovel Feb 4, 2020
79191ad
Added a print method to HttpRequest
Clovel Feb 4, 2020
de52a3c
Updated Httprequest split function
Clovel Feb 4, 2020
11dd62c
Logger.hpp beautifying
Clovel Feb 4, 2020
e58d3f4
Updated HttpRequest parseRequest method
Clovel Feb 4, 2020
7c2f2e7
Use of Logger in wificallbacks.cpp
Clovel Feb 4, 2020
69d2812
Removed "5/" form the URLs sent to the client
Clovel Feb 4, 2020
ac3fbc5
Fixed Logger operator arguments
Clovel Feb 4, 2020
fcd12f0
Fixed HttpRequest string manipulation tools
Clovel Feb 4, 2020
3e073b1
Added more HTTP request information as HttpRequest member variables
Clovel Feb 4, 2020
987e7c7
Close the client at the end of testAccept
Clovel Feb 4, 2020
c897d87
testAccept now builds a HttpRequest object
Clovel Feb 4, 2020
36befdb
Removed log of the recieved header in testAccept
Clovel Feb 4, 2020
1e7c42e
Removed redundant client close in main.cpp
Clovel Feb 4, 2020
371e5eb
Updated HttpRequest::parseRequest
Clovel Feb 4, 2020
58f5d28
Added prohibited practices in notes.md
Clovel Feb 4, 2020
5d9c926
Added missing header guards for HttpRequest.hpp
Clovel Feb 4, 2020
4460de8
Moved restMethod_t from webtools.hpp to HttpRequest.hpp
Clovel Feb 4, 2020
9aec0ce
HttpRequest::parseError now returns a httpRequestParseError_t
Clovel Feb 4, 2020
e766d09
Updated HttpRequest to parse REST method + mMethod member
Clovel Feb 4, 2020
ddcfe23
testAccept's response depends on parseRequest
Clovel Feb 4, 2020
27822df
Attempt to remove WiFiManager logs
Clovel Feb 4, 2020
c38e621
Added Referer attribute to HttpRequest
Clovel Feb 6, 2020
cbc0fbf
Fixed compilation errors & warnings
Clovel Feb 6, 2020
dda1b43
Added WiFiManager as a dependency in the platformio.ini file
Clovel May 12, 2020
57c4bd2
Renamed the testAccept functions => acceptRequest
Clovel May 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Project build plan

on: [push]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]

steps:
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: '3.x'

- name: Installing dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio
pio lib --global install WiFiManager

- name: Checkout
uses: actions/checkout@master

- name: Build Project
run: pio run

43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Project tests

on: [push]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]

steps:
- name: Installing dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
set -x
sudo apt-get update
sudo apt-get install doxygen graphviz

- name: Installing dependencies (macOS)
if: matrix.os == 'macOS-latest'
run: |
set -x
brew update
brew install doxygen graphviz

- name: Checkout
uses: actions/checkout@v1

- name: Create build directory
run: mkdir build

- name: CMake generation
working-directory: build
run: cmake ..

- name: Build tests
working-directory: build
run: make

- name: CTest execution
working-directory: build/software/tests/
run: ctest -VV
26 changes: 24 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ build*/
Testing*/
image_*/
output/


libdeps/

# CMake related files ---------------------------
Makefile
Expand All @@ -28,6 +27,7 @@ CMakeScripts/
html/
latex/
man/
Doxyfile

# MS Office related files -----------------------
~*
Expand All @@ -42,3 +42,25 @@ src_file_list*.txt

# pkg-config generated files --------------------
*.pc

# Binary files ----------------------------------
a.out
*.exe
*.dll
*.dylib
*.a
*.so
*.o

web-example
!web-example/

# macOS files -----------------------------------
.DS_Store

# PlatformIO IDE files --------------------------
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
103 changes: 103 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#
# Copyright (C) 2019 Clovis Durand <[email protected]>
#
# -----------------------------------------------------------------------------

# CMake version required ----------------------------------
cmake_minimum_required(VERSION 3.0)
project(LTBL)

if(NOT DEFINED PRJ_VERSION)
set(PRJ_VERSION "1.0.0")
endif(NOT DEFINED PRJ_VERSION)

# Build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)

# CASE OF C PROJECT
set(CMAKE_C_STANDARD 99)
if(NOT CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat-security" CACHE STRING "C99 compilation flags" FORCE)
endif(NOT CMAKE_C_FLAGS)

# CASE OF CPP PROJECT
set(CMAKE_CXX_STANDARD 17)
if(NOT CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat-security" CACHE STRING "C++11 compilation flags" FORCE)
endif(NOT CMAKE_CXX_FLAGS)

#------------------------------------------------------------------------------
# Project definition, variable and dependencies
#------------------------------------------------------------------------------

set(CMAKE_PROJECT_NAME ${PROJECT_NAME})
set(CMAKE_SYSTEM_NAME ESP8266)

set(CMAKE_PROJECT_BRIEF "LTBL")

# Allow CTest
enable_testing()

find_package(Doxygen)
option(ENABLE_DOCS "Build API documentation" ${DOXYGEN_FOUND})

#------------------------------------------------------------------------------
# Project version
#------------------------------------------------------------------------------

# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

string(REGEX REPLACE
"^([\\.0-9]+).*"
"\\1"
tmp_VERSION
"${PRJ_VERSION}"
)

string(REGEX REPLACE
"^([0-9]+)\\..*"
"\\1"
tmp_SOVERSION
"${tmp_VERSION}"
)

# Major version is for product/marketing purpose
# Minor version is incremented everytime it gets public
set(MAJ_MIN_VERSION ${tmp_VERSION} CACHE STRING "Major and minor version" FORCE)

# Release version is incremented everytime it gets use inside the company
set(RELEASE_VERSION ${tmp_SOVERSION} CACHE STRING "Release version" FORCE)

# Build version is generated using the hash of the current commit build with
set(BUILD_VERSION ${GIT_COMMIT_HASH} CACHE STRING "Build version" FORCE)

#------------------------------------------------------------------------------
# pkgconfig
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Project configuration
#------------------------------------------------------------------------------

add_definitions(-DUNIX)

#------------------------------------------------------------------------------
# Sub-directories
#------------------------------------------------------------------------------

# Main build
# add_subdirectory(src) # TODO : Build main project w/ CMake

add_subdirectory(software/tests)
add_subdirectory(software/docs)
add_subdirectory(examples)
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Lämp
# Let There Be Light !

Connected lamp project
This project aims to create a web-connected lamp controled by both a physical switch and a web page.

# Ressources & Links

- https://www.instructables.com/id/Controlling-AC-light-using-Arduino-with-relay-modu/
- https://tttapa.github.io/ESP8266/Chap01%20-%20ESP8266.html
- https://forum.arduino.cc/index.php?topic=590593.0
- https://developer.myconstellation.io/tutorials/creer-une-prise-connectee-avec-un-esp8266/
- https://randomnerdtutorials.com/wifimanager-with-esp8266-autoconnect-custom-parameter-and-manage-your-ssid-and-password/

# Logger class
The logger class is inspired from https://abrushforeachkeyboard.wordpress.com/2014/06/17/arduino-adding-a-logger-class-with-a-c-style-print-of-messages/
___

# Contributors

Many thanks to the project contributors !

Thanks to :
- [Simon Pavy](https://github.com/simon44530)
- [Clovis Durand](https://github.com/Clovel)
6 changes: 6 additions & 0 deletions docs/notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Serial port read w/ terminal
`sudo cu -l /dev/cu.usbserial-1420 -s 115200`

# Prohibited functions/classes
`std::string::erase` - `Fatal exception 9(LoadStoreAlignmentCause)`
`std::stringstream` - `Fatal exception 9(LoadStoreAlignmentCause)`
Binary file added elec/logic-level-converter.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# Copyright (C) 2019 Clovis Durand <[email protected]>
#
# -----------------------------------------------------------------------------

add_subdirectory(logger_example)
48 changes: 48 additions & 0 deletions examples/logger_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Copyright (C) 2019 Clovis Durand <cd.clovel19²gmail.com>
#
# -----------------------------------------------------------------------------

set(CMAKE_PROJECT_NAME logger-example)
set(CMAKE_SYSTEM_NAME Linux)

set(CMAKE_PROJECT_BRIEF "Logger class example")

#------------------------------------------------------------------------------
# Target configuration for tests
#------------------------------------------------------------------------------

# Header files --------------------------------------------
include_directories(
${CMAKE_SOURCE_DIR}/software/inc
${CMAKE_SOURCE_DIR}/examples/logger_example
)

file(GLOB EXAMPLE_HEADERS
${CMAKE_SOURCE_DIR}/examples/logger_example/*.h
${CMAKE_SOURCE_DIR}/examples/logger_example/*.hpp
)

set(HEADERS
${CMAKE_SOURCE_DIR}/software/inc/Logger.hpp
${CMAKE_SOURCE_DIR}/software/inc/def.h
${EXAMPLE_HEADERS}
)

# Source files --------------------------------------------
file(GLOB EXAMPLE_SOURCES
${CMAKE_SOURCE_DIR}/examples/logger_example/*.c
${CMAKE_SOURCE_DIR}/examples/logger_example/*.cpp
)

set(SOURCES
${CMAKE_SOURCE_DIR}/software/src/Logger.cpp
${EXAMPLE_SOURCES}
)

# Target definition ---------------------------------------
add_definitions(-DTESTS)

add_executable(logger-example
${SOURCES}
)
27 changes: 27 additions & 0 deletions examples/logger_example/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Let There Be Light project
*
* @brief Main source file of the Logger example.
*
* @file main.cpp
*/

/* Includes -------------------------------------------- */
#include "Logger.hpp"

/* Defines --------------------------------------------- */

/* Global variables ------------------------------------ */
//static Logger &sLogger = Logger::instance();

/* main ------------------------------------------------ */
int main(const int argc, const char * const * const argv) {
(void)argc;
(void)argv;

Logger &lLogger = Logger::instance();

lLogger << "[TEST ] Testing logger capabilities !" << endlog;

return 0;
}
Binary file added meca/base-drawing.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = nodemcuv2
workspace_dir = software/
include_dir = software/inc/
src_dir = software/src/

[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags =
-DESP8266
-DESP8266_NODEMCU
-DDEBUG_ESP_CORE
-DDEBUG_ESP_WIFI
-DDEBUG_ESP_HTTP_UPDATE
-DDEBUG_ESP_UPDATER
-DDEBUG_ESP_OTA
-DDEBUG_ESP_PORT=Serial
; -DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h"
-Wall
-Wextra
monitor_speed = 115200
lib_deps = WiFiManager
Loading