From 096645b6e8047ae02c1cda741afe2b41eb837b38 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Sun, 17 Jan 2021 17:59:13 +0100 Subject: [PATCH] update, using nix --- GNUmakefile | 12 ++---- flake.lock | 38 +++++++++++++++++++ flake.nix | 11 ++++++ libraries/AirQuality_Sensor | 1 + libraries/DustSensor | 1 + libraries/Grove_Air_quality_Sensor | 1 + libraries/Grove_Dust_Sensor | 1 + libraries/Grove_High_Precision_RTC_PCF85063TP | 1 + .../Grove_Temperature_And_Humidity_Sensor | 1 + libraries/Humidity_Temperature_Sensor | 1 + libraries/OLED_Display_96X96 | 1 + libraries/RTC | 1 + send.ino | 11 +++--- shell.nix | 27 +++++++++++++ 14 files changed, 95 insertions(+), 13 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 120000 libraries/AirQuality_Sensor create mode 120000 libraries/DustSensor create mode 160000 libraries/Grove_Air_quality_Sensor create mode 160000 libraries/Grove_Dust_Sensor create mode 160000 libraries/Grove_High_Precision_RTC_PCF85063TP create mode 160000 libraries/Grove_Temperature_And_Humidity_Sensor create mode 120000 libraries/Humidity_Temperature_Sensor create mode 160000 libraries/OLED_Display_96X96 create mode 120000 libraries/RTC create mode 100644 shell.nix diff --git a/GNUmakefile b/GNUmakefile index 52b7c63..2bb37e7 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -43,11 +43,6 @@ RRD_CF := AVERAGE ## INO ### -# For GNU/Linux -ARDUINO_DIR := /usr/share/arduino/ -ARDMK_DIR := /usr/share/arduino/ -AVR_TOOLS_DIR := /usr - # For Seeeduino BOARD_TAG := uno @@ -55,12 +50,13 @@ ARDUINO_LIBS := \ AirQuality_Sensor \ DustSensor \ Humidity_Temperature_Sensor \ - LCD_Display9696 \ - RTC \ + OLED_Display_96X96 \ + RTC_DS1307 \ Wire #Grove_Barometer_HP20x + #LCD_Display9696 \ -USER_LIB_PATH := $(realpath ./libraries) +#USER_LIB_PATH := $(realpath ./libraries) ifeq ($(NO_INO),) include $(ARDMK_DIR)/Arduino.mk diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4e573e4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,38 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1610051610, + "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "narHash": "sha256-5KpQQpxDgan0g3+ynPBoZXujR2jUdAQSYIJdwl7j7pk=", + "path": "/nix/store/byb4g2xx02nklia8i7fdfxp3qrf8cp1q-nixpkgs-patched", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..11a6b55 --- /dev/null +++ b/flake.nix @@ -0,0 +1,11 @@ +{ +inputs.nixpkgs.url = "flake:nixpkgs"; +inputs.flake-utils.url = "github:numtide/flake-utils"; +outputs = inputs: + inputs.flake-utils.lib.eachDefaultSystem (system: + let pkgs = inputs.nixpkgs.legacyPackages.${system}; in + { + devShell = import ./shell.nix { inherit inputs pkgs; }; + } + ); +} diff --git a/libraries/AirQuality_Sensor b/libraries/AirQuality_Sensor new file mode 120000 index 0000000..99d124c --- /dev/null +++ b/libraries/AirQuality_Sensor @@ -0,0 +1 @@ +Grove_Air_quality_Sensor \ No newline at end of file diff --git a/libraries/DustSensor b/libraries/DustSensor new file mode 120000 index 0000000..7d996b3 --- /dev/null +++ b/libraries/DustSensor @@ -0,0 +1 @@ +Grove_Dust_Sensor \ No newline at end of file diff --git a/libraries/Grove_Air_quality_Sensor b/libraries/Grove_Air_quality_Sensor new file mode 160000 index 0000000..93f5ba4 --- /dev/null +++ b/libraries/Grove_Air_quality_Sensor @@ -0,0 +1 @@ +Subproject commit 93f5ba4c0fa03a9193e5f4aca5cc9af957c08f9e diff --git a/libraries/Grove_Dust_Sensor b/libraries/Grove_Dust_Sensor new file mode 160000 index 0000000..c0d9094 --- /dev/null +++ b/libraries/Grove_Dust_Sensor @@ -0,0 +1 @@ +Subproject commit c0d90940df1db6b3c53b8b5945aac4864d858003 diff --git a/libraries/Grove_High_Precision_RTC_PCF85063TP b/libraries/Grove_High_Precision_RTC_PCF85063TP new file mode 160000 index 0000000..4ff0e9d --- /dev/null +++ b/libraries/Grove_High_Precision_RTC_PCF85063TP @@ -0,0 +1 @@ +Subproject commit 4ff0e9ddae575a77b443a29ae74b889b4993209a diff --git a/libraries/Grove_Temperature_And_Humidity_Sensor b/libraries/Grove_Temperature_And_Humidity_Sensor new file mode 160000 index 0000000..f6df6d8 --- /dev/null +++ b/libraries/Grove_Temperature_And_Humidity_Sensor @@ -0,0 +1 @@ +Subproject commit f6df6d853728f2f04475861cfcc77ddd4b92213b diff --git a/libraries/Humidity_Temperature_Sensor b/libraries/Humidity_Temperature_Sensor new file mode 120000 index 0000000..1847c32 --- /dev/null +++ b/libraries/Humidity_Temperature_Sensor @@ -0,0 +1 @@ +Grove_Temperature_And_Humidity_Sensor \ No newline at end of file diff --git a/libraries/OLED_Display_96X96 b/libraries/OLED_Display_96X96 new file mode 160000 index 0000000..ecacdd0 --- /dev/null +++ b/libraries/OLED_Display_96X96 @@ -0,0 +1 @@ +Subproject commit ecacdd0ac918c7d0340ce338bafbf7f0dc0867bd diff --git a/libraries/RTC b/libraries/RTC new file mode 120000 index 0000000..2e755f3 --- /dev/null +++ b/libraries/RTC @@ -0,0 +1 @@ +Grove_High_Precision_RTC_PCF85063TP \ No newline at end of file diff --git a/send.ino b/send.ino index 0349579..bef4039 100644 --- a/send.ino +++ b/send.ino @@ -62,7 +62,8 @@ void loop_serial_read () { /* Oled */ void setup_oled () { - SeeedGrayOled.init(); + //SeeedGrayOled.init(SH1107G); + SeeedGrayOled.init(SSD1327); SeeedGrayOled.clearDisplay(); SeeedGrayOled.setNormalDisplay(); // Set display to normal mode (i.e non-inverse mode) SeeedGrayOled.setVerticalMode(); @@ -202,7 +203,7 @@ void loop_dht () { SeeedGrayOled.setTextXY(2,0); SeeedGrayOled.putString("T: "); SeeedGrayOled.setTextXY(2,3); - SeeedGrayOled.putFloat(t); + SeeedGrayOled.putNumber(t); SeeedGrayOled.putString("*C"); } @@ -218,7 +219,7 @@ void loop_dht () { SeeedGrayOled.setTextXY(3,0); SeeedGrayOled.putString("H: "); SeeedGrayOled.setTextXY(3,3); - SeeedGrayOled.putFloat(h); + SeeedGrayOled.putNumber(h); SeeedGrayOled.putString("%"); } } @@ -339,9 +340,9 @@ void loop_fire () { SeeedGrayOled.setTextXY(7,0); SeeedGrayOled.putString("Feu: "); SeeedGrayOled.setTextXY(7,5); - //SeeedGrayOled.putFloat(mq9_ratio); + //SeeedGrayOled.putNumber(mq9_ratio); //Serial.print(mq9_ratio); - SeeedGrayOled.putFloat(mq9_R0_); + SeeedGrayOled.putNumber(mq9_R0_); } } diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..e4657e2 --- /dev/null +++ b/shell.nix @@ -0,0 +1,27 @@ +{ inputs, pkgs, ... }: +pkgs.mkShell { + name = "air-duino"; + src = null; + #preferLocalBuild = true; + #allowSubstitutes = false; + buildInputs = with pkgs; [ + arduino + arduino-core + arduino-mk + gcc + gcc-arm-embedded + avrdude + ]; + #enableParallelBuilding = true; + + ARDUINO = pkgs.arduino; + ARDUINO_PATH = pkgs.arduino-core; + ARDUINO_DIR = pkgs.arduino-core + "/share/arduino"; + ARDMK_DIR = pkgs.arduino-mk; + AVR_TOOLS_DIR = pkgs.arduino + "/share/arduino/hardware/tools/avr"; + USER_LIB_PATH = toString ./. + "/libraries"; + + #PATH="${pkgs.arduino + "/share/arduino/hardware/tools/avr/bin"}:$PATH" + shellHook = '' + ''; +} -- 2.47.0