Skip to content
Snippets Groups Projects
Verified Commit 095dbb1c authored by Legy (Beini)'s avatar Legy (Beini)
Browse files

Restucture and make the device folder a component

This is importent to ease the possibility of using EMBED_TXTFILES to
embed the .pem certificate into the image.
parent 67233108
Branches feature/bme280
No related tags found
2 merge requests!14WIP: Mqtts,!13WIP: Idf 40
...@@ -5,9 +5,9 @@ sdkconfig.old ...@@ -5,9 +5,9 @@ sdkconfig.old
# This directory contains user-specific devices # This directory contains user-specific devices
/devices/* /devices/*
# Ignore symlink to current device # Ignore symlink to current device
/main/device /main
# This directory contains user-specific environment configurations # This directory contains user-specific environment configurations
/environments/* /environments/*
# Ignore symlink to current environment # Ignore symlink to current environment
/main/environment.h /qthing/environment.h
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
idf_build_component(qthing)
project(qthing) project(qthing)
...@@ -37,15 +37,14 @@ let ...@@ -37,15 +37,14 @@ let
''; '';
qthingBaseRepo = pkgs.runCommand "qthing" {} '' qthingBaseRepo = pkgs.runCommand "qthing" {} ''
mkdir -p $out/main mkdir -p $out/qthing
for file in CMakeLists.txt components esp-idf sdkconfig; do for file in CMakeLists.txt components esp-idf sdkconfig; do
ln -s ${./.}/$file $out/$file ln -s ${./.}/$file $out/$file
done done
cd ${./.}/main cd ${./.}/qthing
for file in *; do for file in *; do
[[ "$file" == device ]] && continue
[[ "$file" == environment.h ]] && continue [[ "$file" == environment.h ]] && continue
ln -s ${./.}/main/$file $out/main/$file ln -s ${./.}/qthing/$file $out/qthing/$file
done done
''; '';
...@@ -57,7 +56,7 @@ in rec { ...@@ -57,7 +56,7 @@ in rec {
shellHook = shellSetup; shellHook = shellSetup;
}; };
mkProject = { name, device, environment }: let mkProject = { name, src, environment }: let
flashScript = pkgs.writeScript "flash" '' flashScript = pkgs.writeScript "flash" ''
PATH=${pkgs.esptool}/bin/:$PATH PATH=${pkgs.esptool}/bin/:$PATH
cd @out@ cd @out@
...@@ -68,9 +67,9 @@ in rec { ...@@ -68,9 +67,9 @@ in rec {
buildInputs = qthingDependencies; buildInputs = qthingDependencies;
unpackPhase = '' unpackPhase = ''
cp --reflink=auto -r ${qthingBaseRepo}/* ./ cp --reflink=auto -r ${qthingBaseRepo}/* ./
chmod -R u+w . chmod u+w qthing
cp --reflink=auto -r ${device} ./main/device cp --reflink=auto -r ${src} ./main
cp --reflink=auto ${environment} ./main/environment.h cp --reflink=auto ${environment} ./qthing/environment.h
''; '';
configurePhase = shellSetup + '' configurePhase = shellSetup + ''
patchShebangs esp-idf patchShebangs esp-idf
......
idf_component_register( idf_component_register(
SRC_DIRS SRC_DIRS
"." "."
"device"
"network" "network"
"peripherals" "peripherals"
"system" "system"
...@@ -15,6 +14,7 @@ idf_component_register( ...@@ -15,6 +14,7 @@ idf_component_register(
LiquidCrystal LiquidCrystal
app_update app_update
arduino-esp32 arduino-esp32
main
mqtt mqtt
nvs_flash nvs_flash
rc-switch rc-switch
......
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <vector> #include <vector>
#include <functional> #include <functional>
#include "device/device_config.h" #include "device_config.h"
#ifndef MEASURED_PERIOD_MS #ifndef MEASURED_PERIOD_MS
#define MEASURED_PERIOD_MS 1000 #define MEASURED_PERIOD_MS 1000
...@@ -55,4 +55,4 @@ namespace qthing { ...@@ -55,4 +55,4 @@ namespace qthing {
void mqtt(const std::vector<qthing::measured::sensor_data_t>& data); void mqtt(const std::vector<qthing::measured::sensor_data_t>& data);
} }
} }
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "environment.h" #include "environment.h"
#include "event.h" #include "event.h"
#include "device/device_config.h" #include "device_config.h"
#include "io.h" #include "io.h"
#include <new> #include <new>
......
File moved
File moved
File moved
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define MQTT_COMMON_H #define MQTT_COMMON_H
#include "environment.h" #include "environment.h"
#include "device/device_config.h" #include "device_config.h"
#define STATUS_TOPIC DEVICE_NAMESPACE "status" #define STATUS_TOPIC DEVICE_NAMESPACE "status"
#define STATUS_MESSAGE_ONLINE "online" #define STATUS_MESSAGE_ONLINE "online"
...@@ -21,4 +21,4 @@ ...@@ -21,4 +21,4 @@
#define OTA_STATE_TOPIC DEVICE_NAMESPACE "ota/state" #define OTA_STATE_TOPIC DEVICE_NAMESPACE "ota/state"
#define OTA_ERROR_TOPIC DEVICE_NAMESPACE "ota/error" #define OTA_ERROR_TOPIC DEVICE_NAMESPACE "ota/error"
#endif #endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment