Added temperature handling and temperature wordmap. Also removed to old versions. Integrated and functional
This commit is contained in:
-3927
File diff suppressed because it is too large
Load Diff
@@ -21,8 +21,8 @@ idf_component_register(
|
|||||||
"application/src/daywordmap.cpp"
|
"application/src/daywordmap.cpp"
|
||||||
"application/src/wordmap.cpp"
|
"application/src/wordmap.cpp"
|
||||||
"application/src/ota.cpp"
|
"application/src/ota.cpp"
|
||||||
# "old/src/temperaturewordmap.cpp"
|
"application/src/temperaturewordmap.cpp"
|
||||||
# "old/src/temperature.cpp"
|
"application/src/temperature.cpp"
|
||||||
INCLUDE_DIRS # optional, add here public include directories
|
INCLUDE_DIRS # optional, add here public include directories
|
||||||
"./"
|
"./"
|
||||||
"hal/inc"
|
"hal/inc"
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#ifndef MAIN_INC_TEMPERATURE_H_
|
#ifndef MAIN_APPLICATION_INC_TEMPERATURE_H_
|
||||||
#define MAIN_INC_TEMPERATURE_H_
|
#define MAIN_APPLICATION_INC_TEMPERATURE_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* temperature implementation
|
* temperature implementation
|
||||||
@@ -34,20 +34,20 @@
|
|||||||
|
|
||||||
// CompilerIncludes
|
// CompilerIncludes
|
||||||
// All include files that are provided by the compiler directly
|
// All include files that are provided by the compiler directly
|
||||||
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ProjectIncludes
|
// ProjectIncludes
|
||||||
// All include files that are provided by the project
|
// All include files that are provided by the project
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// Constant and macro definitions
|
// Constant and macro definitions
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// Type definitions.
|
// Type definitions.
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -58,23 +58,33 @@
|
|||||||
// Function declarations
|
// Function declarations
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
using namespace std;
|
class temperature
|
||||||
|
|
||||||
class Temperature
|
|
||||||
{
|
{
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public Section
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
public:
|
public:
|
||||||
Temperature(void);
|
// Class Constructor
|
||||||
|
temperature();
|
||||||
|
|
||||||
void generateWordlist(int temperature, list<string>* wordlist);
|
void generateWordlist(int temperature, std::list<std::string>* wordlist);
|
||||||
|
|
||||||
void calculateRGB(int temperature, uint8_t* red, uint8_t* green, uint8_t* blue);
|
void calculateRGB(int temperature, uint8_t* red, uint8_t* green, uint8_t* blue);
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Protected Section
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Private Section
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
private:
|
private:
|
||||||
int minTemperature;
|
int minTemperature;
|
||||||
int maxTemperature;
|
int maxTemperature;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#endif /* MAIN_INC_TEMPERATURE_H_ */
|
|
||||||
|
#endif /* MAIN_APPLICATION_INC_TEMPERATURE_H_ */
|
||||||
+26
-12
@@ -1,5 +1,5 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
/// \file TemperatureWordmap.h
|
/// \file temperaturewordmap.h
|
||||||
/// \brief File description
|
/// \brief File description
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -13,12 +13,12 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#ifndef MAIN_INC_TEMPERATUREWORDMAP_H_
|
#ifndef MAIN_APPLICATION_INC_TEMPERATUREWORDMAP_H_
|
||||||
#define MAIN_INC_TEMPERATUREWORDMAP_H_
|
#define MAIN_APPLICATION_INC_TEMPERATUREWORDMAP_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TemperatureWordmap implementation
|
* temperaturewordmap implementation
|
||||||
* \defgroup TemperatureWordmap
|
* \defgroup temperaturewordmap
|
||||||
* \brief {group_description}
|
* \brief {group_description}
|
||||||
* \addtogroup {Layer}
|
* \addtogroup {Layer}
|
||||||
*
|
*
|
||||||
@@ -46,7 +46,6 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// Type definitions.
|
// Type definitions.
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -57,17 +56,32 @@
|
|||||||
// Function declarations
|
// Function declarations
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class TemperatureWordmap: public Wordmap
|
class temperaturewordmap: public wordmap
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
TemperatureWordmap(LEDMatrix* matrix);
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public Section
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
// Class Constructor
|
||||||
|
temperaturewordmap(ledmatrix* matrix);
|
||||||
|
~temperaturewordmap();
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Protected Section
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
protected:
|
protected:
|
||||||
void createList_NL(void);
|
void createList_NL(void);
|
||||||
// void createList_EN(void);
|
void createList_EN(void);
|
||||||
};
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Private Section
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#endif /* MAIN_INC_TEMPERATUREWORDMAP_H_ */
|
|
||||||
|
#endif /* MAIN_APPLICATION_INC_TEMPERATUREWORDMAP_H_ */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// Include files
|
// Include files
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "temperature.h"
|
#include <temperature.h>
|
||||||
|
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// Type definitions
|
// Type definitions
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -49,14 +48,14 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
Temperature::Temperature()
|
temperature::temperature()
|
||||||
{
|
{
|
||||||
Temperature::minTemperature = 14;
|
this->minTemperature = 14;
|
||||||
Temperature::maxTemperature = 29;
|
this->maxTemperature = 29;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void Temperature::generateWordlist(int temperature, list<string>* wordlist)
|
void temperature::generateWordlist(int temperature, std::list<std::string>* wordlist)
|
||||||
{
|
{
|
||||||
// Clear the list
|
// Clear the list
|
||||||
wordlist->clear();
|
wordlist->clear();
|
||||||
@@ -68,17 +67,17 @@ void Temperature::generateWordlist(int temperature, list<string>* wordlist)
|
|||||||
// Temperature value to string
|
// Temperature value to string
|
||||||
if (temperature < minTemperature)
|
if (temperature < minTemperature)
|
||||||
{
|
{
|
||||||
wordlist->push_back("below");
|
wordlist->push_back("below");
|
||||||
wordlist->push_back(to_string(minTemperature));
|
wordlist->push_back(std::to_string(minTemperature));
|
||||||
}
|
}
|
||||||
else if (temperature > maxTemperature)
|
else if (temperature > maxTemperature)
|
||||||
{
|
{
|
||||||
wordlist->push_back("above");
|
wordlist->push_back("above");
|
||||||
wordlist->push_back(to_string(maxTemperature));
|
wordlist->push_back(std::to_string(maxTemperature));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wordlist->push_back(to_string(temperature));
|
wordlist->push_back(std::to_string(temperature));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add fixed postamble
|
// Add fixed postamble
|
||||||
@@ -86,38 +85,38 @@ void Temperature::generateWordlist(int temperature, list<string>* wordlist)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Temperature::calculateRGB(int temperature, uint8_t* red, uint8_t* green, uint8_t* blue)
|
void temperature::calculateRGB(int temperature, uint8_t* red, uint8_t* green, uint8_t* blue)
|
||||||
{
|
{
|
||||||
int calcBlue = 0;
|
int calcBlue = 0;
|
||||||
int calcRed = 0;
|
int calcRed = 0;
|
||||||
|
|
||||||
int factor = 100 / (maxTemperature - minTemperature);
|
int factor = 100 / (maxTemperature - minTemperature);
|
||||||
|
|
||||||
LOGGER_INFO("Incoming Temperature is: %i (min: %i, max: %i", temperature, minTemperature, maxTemperature);
|
LOGGER_INFO("Incoming Temperature is: %i (min: %i, max: %i)", temperature, minTemperature, maxTemperature);
|
||||||
|
|
||||||
if (temperature < minTemperature)
|
if (temperature < minTemperature)
|
||||||
{
|
{
|
||||||
calcBlue = 0xFF;
|
calcBlue = 0xFF;
|
||||||
calcRed = 0x00;
|
calcRed = 0x00;
|
||||||
}
|
}
|
||||||
else if (temperature > maxTemperature)
|
else if (temperature > maxTemperature)
|
||||||
{
|
{
|
||||||
calcBlue = 0x00;
|
calcBlue = 0x00;
|
||||||
calcRed = 0xFF;
|
calcRed = 0xFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
calcBlue = (((maxTemperature - temperature) * factor) * 0xFF) / 100;
|
calcBlue = (((maxTemperature - temperature) * factor) * 0xFF) / 100;
|
||||||
calcRed = (((temperature - minTemperature) * factor) * 0xFF) / 100;
|
calcRed = (((temperature - minTemperature) * factor) * 0xFF) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER_PRINT("\n\rRed %i %x (%i)", calcRed, calcRed, (temperature - minTemperature) * factor);
|
LOGGER_PRINT("\n\rRed %i %x (%i)", calcRed, calcRed, (temperature - minTemperature) * factor);
|
||||||
LOGGER_PRINT("\n\rGreen %i %x", 0, 0);
|
LOGGER_PRINT("\n\rGreen %i %x", 0, 0);
|
||||||
LOGGER_PRINT("\n\rBlue %i %x (%i)", calcBlue, calcBlue, (maxTemperature - temperature) * factor);
|
LOGGER_PRINT("\n\rBlue %i %x (%i)", calcBlue, calcBlue, (maxTemperature - temperature) * factor);
|
||||||
|
|
||||||
*red = calcRed & 0xFF;
|
*red = calcRed & 0xFF;
|
||||||
*green = 0x00;
|
*green = 0x00;
|
||||||
*blue = calcBlue & 0xFF;
|
*blue = calcBlue & 0xFF;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+11
-9
@@ -17,16 +17,13 @@
|
|||||||
// Include files
|
// Include files
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "temperaturewordmap.h"
|
#include <temperaturewordmap.h>
|
||||||
|
|
||||||
#include "logger.h"
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// Constant and macro definitions
|
// Constant and macro definitions
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// Type definitions
|
// Type definitions
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -49,13 +46,18 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
TemperatureWordmap::TemperatureWordmap(LEDMatrix* matrix) : Wordmap(matrix)
|
temperaturewordmap::temperaturewordmap(ledmatrix* matrix) : wordmap(matrix)
|
||||||
{
|
{
|
||||||
createList_NL();
|
createList_NL();
|
||||||
createList_EN();
|
createList_EN();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemperatureWordmap::createList_NL(void)
|
temperaturewordmap::~temperaturewordmap()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void temperaturewordmap::createList_NL(void)
|
||||||
{
|
{
|
||||||
// First, clear the list
|
// First, clear the list
|
||||||
wordlist[NL].clear();
|
wordlist[NL].clear();
|
||||||
@@ -90,7 +92,7 @@ void TemperatureWordmap::createList_NL(void)
|
|||||||
wordlist[NL].push_back((struct word){"degrees", {{14,9},{15,9},{16,9},{17,9},{18,9},{19,9}}});
|
wordlist[NL].push_back((struct word){"degrees", {{14,9},{15,9},{16,9},{17,9},{18,9},{19,9}}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void temperaturewordmap::createList_EN(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+59
-55
@@ -45,6 +45,8 @@
|
|||||||
#include "clockwordmap.h"
|
#include "clockwordmap.h"
|
||||||
#include "daywordmap.h"
|
#include "daywordmap.h"
|
||||||
#include "ota.h"
|
#include "ota.h"
|
||||||
|
#include "temperature.h"
|
||||||
|
#include "temperaturewordmap.h"
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// Constant and macro definitions
|
// Constant and macro definitions
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -107,9 +109,6 @@ extern "C" void app_main(void)
|
|||||||
ret = nvs_flash_init();
|
ret = nvs_flash_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGE("Test", "System start");
|
|
||||||
vTaskDelay(100);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
// UART
|
// UART
|
||||||
//
|
//
|
||||||
@@ -128,15 +127,10 @@ extern "C" void app_main(void)
|
|||||||
ESP_ERROR_CHECK(uart_set_pin(debugUart, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
|
ESP_ERROR_CHECK(uart_set_pin(debugUart, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
|
||||||
ESP_ERROR_CHECK(uart_driver_install(debugUart, 1024, 1024, 0, NULL, 0));
|
ESP_ERROR_CHECK(uart_driver_install(debugUart, 1024, 1024, 0, NULL, 0));
|
||||||
|
|
||||||
ESP_LOGE("Test", "Uart installed");
|
|
||||||
vTaskDelay(100);
|
|
||||||
|
|
||||||
// uart uartDebug = uart(&debugUart);
|
// uart uartDebug = uart(&debugUart);
|
||||||
// uartDebug.open();
|
// uartDebug.open();
|
||||||
// uartDebug.write(255, 255, (uint8_t*)"START", 5);
|
// uartDebug.write(255, 255, (uint8_t*)"START", 5);
|
||||||
|
|
||||||
ESP_LOGE("Test", "Uart interface open");
|
|
||||||
vTaskDelay(100);
|
|
||||||
|
|
||||||
esplog esplogger = esplog();
|
esplog esplogger = esplog();
|
||||||
esplogger.open();
|
esplogger.open();
|
||||||
@@ -150,9 +144,6 @@ extern "C" void app_main(void)
|
|||||||
// Call the logger executable within a dedicated task and forget about it afterwards
|
// Call the logger executable within a dedicated task and forget about it afterwards
|
||||||
xTaskCreate(loggerTask, (const char*)"loggerTask", 3000, &debugLogger, 3, &loggerTaskHandle);
|
xTaskCreate(loggerTask, (const char*)"loggerTask", 3000, &debugLogger, 3, &loggerTaskHandle);
|
||||||
|
|
||||||
ESP_LOGE("Test", "Logger Task started");
|
|
||||||
vTaskDelay(100);
|
|
||||||
|
|
||||||
LOGGER_PRINT("\n\r-----------------------------------------------------------------------\n\r");
|
LOGGER_PRINT("\n\r-----------------------------------------------------------------------\n\r");
|
||||||
LOGGER_PRINT("System Start\n\r");
|
LOGGER_PRINT("System Start\n\r");
|
||||||
LOGGER_PRINT("\n\r");
|
LOGGER_PRINT("\n\r");
|
||||||
@@ -160,30 +151,27 @@ extern "C" void app_main(void)
|
|||||||
LOGGER_PRINT("Release: %d.%d \n\r", MAJORRELEASE, MINORRELEASE);
|
LOGGER_PRINT("Release: %d.%d \n\r", MAJORRELEASE, MINORRELEASE);
|
||||||
LOGGER_PRINT("Compiled on %s at %s\n\r\n\r\n\r", __DATE__, __TIME__);
|
LOGGER_PRINT("Compiled on %s at %s\n\r\n\r\n\r", __DATE__, __TIME__);
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// I2C Masterbus for sensoring peripherals
|
||||||
|
//
|
||||||
|
i2c_port_t i2c_master_port = I2C_NUM_0;
|
||||||
|
|
||||||
|
i2c_config_t i2cConfig = {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = (int)GPIO_I2C_SDA,
|
||||||
|
.scl_io_num = (int)GPIO_I2C_SCK,
|
||||||
|
.sda_pullup_en = GPIO_PULLUP_ENABLE,
|
||||||
|
.scl_pullup_en = GPIO_PULLUP_ENABLE,
|
||||||
|
.master = 400000,
|
||||||
|
.clk_flags = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(i2c_param_config(i2c_master_port, &i2cConfig));
|
||||||
|
ESP_ERROR_CHECK(i2c_driver_install(i2c_master_port, i2cConfig.mode, 0, 0, 0));
|
||||||
|
|
||||||
|
i2c i2cSensor = i2c(&i2c_master_port);
|
||||||
|
i2cSensor.open();
|
||||||
|
|
||||||
ESP_LOGE("Test", "Logger System Rpintout");
|
|
||||||
vTaskDelay(100);
|
|
||||||
// // -----------------------------------------------------------------------------------------------------------------
|
|
||||||
// // I2C Masterbus for sensoring peripherals
|
|
||||||
// //
|
|
||||||
// i2c_port_t i2c_master_port = I2C_NUM_0;
|
|
||||||
//
|
|
||||||
// i2c_config_t i2cConfig = {
|
|
||||||
// .mode = I2C_MODE_MASTER,
|
|
||||||
// .sda_io_num = (int)2,
|
|
||||||
// .scl_io_num = (int)3,
|
|
||||||
// .sda_pullup_en = GPIO_PULLUP_ENABLE,
|
|
||||||
// .scl_pullup_en = GPIO_PULLUP_ENABLE,
|
|
||||||
// .master = 400000,
|
|
||||||
// .clk_flags = 0
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// ESP_ERROR_CHECK(i2c_param_config(i2c_master_port, &i2cConfig));
|
|
||||||
// ESP_ERROR_CHECK(i2c_driver_install(i2c_master_port, i2cConfig.mode, 0, 0, 0));
|
|
||||||
//
|
|
||||||
// i2c i2cSensor = i2c(&i2c_master_port);
|
|
||||||
// i2cSensor.open();
|
|
||||||
//
|
|
||||||
// // -----------------------------------------------------------------------------------------------------------------
|
// // -----------------------------------------------------------------------------------------------------------------
|
||||||
// // I2C RGB Sensor on I2C MasterBus for sensors
|
// // I2C RGB Sensor on I2C MasterBus for sensors
|
||||||
// //
|
// //
|
||||||
@@ -197,33 +185,27 @@ extern "C" void app_main(void)
|
|||||||
// struct isl29125::rgb_t rgbValue;
|
// struct isl29125::rgb_t rgbValue;
|
||||||
// rgbSensor.getRGB(&rgbValue);
|
// rgbSensor.getRGB(&rgbValue);
|
||||||
|
|
||||||
// // -----------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
// // I2C RGB Sensor on I2C MasterBus for sensors
|
// I2C RGB Sensor on I2C MasterBus for sensors
|
||||||
// //
|
//
|
||||||
// bmp280 tempSensor = bmp280(0x76, i2cSensor);
|
bmp280 tempSensor = bmp280(0x76, i2cSensor);
|
||||||
// // Reset the sensor
|
// Reset the sensor
|
||||||
// tempSensor.resetSensor();
|
tempSensor.resetSensor();
|
||||||
// // Make sure to apply a wait cycle between reset and continuous use - 2ms is advised as minimum
|
// Make sure to apply a wait cycle between reset and continuous use - 2ms is advised as minimum
|
||||||
// vTaskDelay(10);
|
vTaskDelay(10);
|
||||||
// // Initialize the BMP280
|
// Initialize the BMP280
|
||||||
// tempSensor.initialize();
|
tempSensor.initialize();
|
||||||
// // Set the temperature Oversampling
|
// Set the temperature Oversampling
|
||||||
// tempSensor.setSensorTemperatureOversampling(bmp280::BMP280_Oversampling_t::X1);
|
tempSensor.setSensorTemperatureOversampling(bmp280::BMP280_Oversampling_t::X1);
|
||||||
// // Set the sensor to NORMAL mode
|
// Set the sensor to NORMAL mode
|
||||||
// tempSensor.setSensorMode(bmp280::BMP280_Mode_t::NORMAL);
|
tempSensor.setSensorMode(bmp280::BMP280_Mode_t::NORMAL);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
// Wifi create and connect
|
// Wifi create and connect
|
||||||
//
|
//
|
||||||
Wifi wifi = Wifi();
|
Wifi wifi = Wifi();
|
||||||
ESP_LOGE("Test", "Wifi object created");
|
|
||||||
vTaskDelay(100);
|
|
||||||
|
|
||||||
wifi.start_client();
|
wifi.start_client();
|
||||||
|
|
||||||
ESP_LOGE("Test", "Wifi started");
|
|
||||||
vTaskDelay(100);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
// Programmable LEDs in a strip
|
// Programmable LEDs in a strip
|
||||||
//
|
//
|
||||||
@@ -236,6 +218,11 @@ extern "C" void app_main(void)
|
|||||||
//
|
//
|
||||||
Clock clk = Clock(Clock::Mode_t::TEN_BEFORE_HALF);
|
Clock clk = Clock(Clock::Mode_t::TEN_BEFORE_HALF);
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// The Temperature class that calculates temperature string and colour
|
||||||
|
//
|
||||||
|
temperature temp = temperature();
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
// Wordmaps for clock(time), clock(day) and temperature
|
// Wordmaps for clock(time), clock(day) and temperature
|
||||||
//
|
//
|
||||||
@@ -245,6 +232,8 @@ extern "C" void app_main(void)
|
|||||||
DayWordmap daywords = DayWordmap(&matrix);
|
DayWordmap daywords = DayWordmap(&matrix);
|
||||||
daywords.setColour(0xFF, 0x00, 0x80);
|
daywords.setColour(0xFF, 0x00, 0x80);
|
||||||
|
|
||||||
|
temperaturewordmap tempwords = temperaturewordmap(&matrix);
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
// OTA handler
|
// OTA handler
|
||||||
@@ -255,6 +244,7 @@ extern "C" void app_main(void)
|
|||||||
xTaskCreate(otaTask, (const char*)"OTATask", 4000, &otaUpdater, 3, &otaTaskHandle);
|
xTaskCreate(otaTask, (const char*)"OTATask", 4000, &otaUpdater, 3, &otaTaskHandle);
|
||||||
|
|
||||||
std::list<std::string> clockWordlist;
|
std::list<std::string> clockWordlist;
|
||||||
|
std::list<std::string> tempWordList;
|
||||||
|
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
@@ -269,6 +259,20 @@ extern "C" void app_main(void)
|
|||||||
daywords.setWord(wordmap::Language_t::NL, *it, true);
|
daywords.setWord(wordmap::Language_t::NL, *it, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the temperature from sensor
|
||||||
|
int currentTemperature = tempSensor.getTemperature() / 100;
|
||||||
|
|
||||||
|
LOGGER_INFO("The current temperature is: %i (%s)", currentTemperature, std::to_string(21));
|
||||||
|
// Generate temperature wordlist
|
||||||
|
temp.generateWordlist(currentTemperature, &tempWordList);
|
||||||
|
for(it = tempWordList.begin(); it != tempWordList.end(); it++)
|
||||||
|
{
|
||||||
|
tempwords.setWord(wordmap::Language_t::NL, *it, true);
|
||||||
|
}
|
||||||
|
uint8_t tRed, tGreen, tBlue;
|
||||||
|
temp.calculateRGB(currentTemperature, &tRed, &tGreen, &tBlue);
|
||||||
|
tempwords.setColour(tRed, tGreen, tBlue);
|
||||||
|
|
||||||
matrix.update();
|
matrix.update();
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
}
|
}
|
||||||
@@ -292,7 +296,7 @@ void otaTask(void* parameters)
|
|||||||
ota* otaHandler = (ota*) parameters;
|
ota* otaHandler = (ota*) parameters;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
otaHandler->task();
|
// otaHandler->task();
|
||||||
vTaskDelay(otaHandler->checkInterval_ms);
|
vTaskDelay(otaHandler->checkInterval_ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user