EnvronmentManagement/ESP-Temp-Humidity/include/main.h

42 lines
866 B
C
Raw Normal View History

2021-09-24 01:48:26 +01:00
#pragma once
#include <BME280I2C.h>
#include <Ticker.h>
#include <U8g2lib.h>
#include <ESP8266HTTPClient.h>
2021-10-02 01:43:52 +01:00
#include "byte_buffer.h"
2021-09-24 01:48:26 +01:00
//scl D1
//sda D2
U8G2_SSD1306_128X32_WINSTAR_1_SW_I2C screen(U8G2_R0, PIN_WIRE_SCL, PIN_WIRE_SDA);
BME280I2C bme;
Ticker environmentUpdate;
Ticker environmentPost;
HTTPClient requests;
WiFiClient client;
BME280::TempUnit tempUnit(BME280::TempUnit_Celsius);
BME280::PresUnit presUnit(BME280::PresUnit_Pa);
float pressure = 0;
float temp = 0;
float humidity = 0;
#define LINE_1 11
#define LINE_2 23
#define FONT u8g2_font_helvR10_te
#define TEMP "Temperature: "
#define HUMID "Humidity: "
2021-10-02 01:43:52 +01:00
#define DERIVATION_HASH_SIZE 32
static constexpr const char *DERIVATION_SALT = "ENVIRONMENT";
2021-09-24 01:48:26 +01:00
void UpdateEnvironment();
void PostEnvironment();
void InitializeWifi();
2021-10-02 01:43:52 +01:00
utils::byte_buffer Encrypt(std::string data);
void DeriveKey();