Compare commits

...

3 Commits

Author SHA1 Message Date
Martin Brodbeck 98cf010c4b Also disable the other buttons temporarily. 2022-12-23 20:14:51 +01:00
Martin Brodbeck 1e70cbb13d fixes #2 2022-12-23 13:29:10 +01:00
Martin Brodbeck f19a5bab0d Better use C++17 2022-12-23 13:17:36 +01:00
4 changed files with 19 additions and 9 deletions

View File

@ -1,23 +1,23 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-exceptions")
# Initialise pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
#set(PICO_SDK_PATH "/usr/share/pico-sdk")
set(PICO_SDK_PATH "/home/martin/pico/pico-sdk")
set(PICO_SDK_PATH "/usr/share/pico-sdk")
#set(PICO_SDK_PATH "/home/martin/pico/pico-sdk")
# Pull in Raspberry Pi Pico SDK (must be before project)
include("cmake/pico_sdk_import.cmake")
project(gbmanager VERSION "1.0.1" LANGUAGES C CXX ASM)
project(gbmanager VERSION "1.0.3" LANGUAGES C CXX ASM)
# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()
add_subdirectory(modules/pico-onewire)
add_subdirectory(modules/fmt)
add_subdirectory(src)
add_subdirectory(src)

View File

@ -108,7 +108,7 @@ int main() {
relais.activate(isHeating);
lcdText = fmt::format("ACT: {:05.2f}{}C {}\nACT: {:05.2f}{}C {}",
lcdText = fmt::format("ACT: {:05.2f}{}C {}\nTGT: {:05.2f}{}C {}",
temp_act, CUSTOM_CHAR_DEG, heatInfo, temp_tgt,
CUSTOM_CHAR_DEG, systemInfo);
myLCD.setCursor(0, 0);
@ -116,4 +116,4 @@ int main() {
sleep_until((absolute_time_t){destTime});
}
}
}

View File

@ -14,14 +14,22 @@ void Relais::activate(bool active) {
lastState = active;
gpio_set_irq_enabled_with_callback(BUTTON_1_PIN, GPIO_IRQ_EDGE_FALL, false,
callback);
gpio_set_irq_enabled_with_callback(BUTTON_2_PIN, GPIO_IRQ_EDGE_FALL, false,
callback);
gpio_set_irq_enabled_with_callback(BUTTON_3_PIN, GPIO_IRQ_EDGE_FALL, false,
callback);
gpio_put(gpio, !active);
sleep_ms(100);
gpio_set_irq_enabled_with_callback(BUTTON_1_PIN, GPIO_IRQ_EDGE_FALL, true,
callback);
gpio_set_irq_enabled_with_callback(BUTTON_2_PIN, GPIO_IRQ_EDGE_FALL, true,
callback);
gpio_set_irq_enabled_with_callback(BUTTON_3_PIN, GPIO_IRQ_EDGE_FALL, true,
callback);
}
void Relais::on() { activate(true); }
void Relais::off() { activate(false); }
void Relais::off() { activate(false); }

View File

@ -4,6 +4,8 @@
#include "hardware/gpio.h"
#include "pico/stdlib.h"
extern const uint BUTTON_1_PIN; // declared in gbmanager.cpp
extern const uint BUTTON_2_PIN; // declared in gbmanager.cpp
extern const uint BUTTON_3_PIN; // declared in gbmanager.cpp
class Relais {
@ -19,4 +21,4 @@ class Relais {
gpio_irq_callback_t callback;
};
#endif
#endif