credentials: cleaned git history, put creds in separate file
This commit is contained in:
parent
c1db9cb7f4
commit
cc75cd9759
2 changed files with 15 additions and 12 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -23,3 +23,7 @@ CMakeUserPresets.json
|
||||||
# build folder
|
# build folder
|
||||||
build/
|
build/
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/cmake
|
# End of https://www.toptal.com/developers/gitignore/api/cmake
|
||||||
|
|
||||||
|
# Credentials
|
||||||
|
include/credentials.h
|
||||||
|
replacements.txt
|
||||||
|
|
|
||||||
23
src/main.c
23
src/main.c
|
|
@ -18,12 +18,13 @@
|
||||||
* the readings to Adafruit IO over MQTT using the Pico W.
|
* the readings to Adafruit IO over MQTT using the Pico W.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "credentials.h"
|
||||||
#include "aht.h"
|
#include "aht.h"
|
||||||
#include "bmp.h"
|
#include "bmp.h"
|
||||||
#include "ens.h"
|
#include "ens.h"
|
||||||
#include "mqtt.h"
|
|
||||||
#include "hardware/gpio.h"
|
#include "hardware/gpio.h"
|
||||||
#include "hardware/i2c.h"
|
#include "hardware/i2c.h"
|
||||||
|
#include "mqtt.h"
|
||||||
#include "pico/cyw43_arch.h"
|
#include "pico/cyw43_arch.h"
|
||||||
#include "pico/stdlib.h" // IWYU pragma: keep
|
#include "pico/stdlib.h" // IWYU pragma: keep
|
||||||
#include <boards/pico_w.h>
|
#include <boards/pico_w.h>
|
||||||
|
|
@ -38,10 +39,7 @@
|
||||||
#define I2C1_SDA_PIN 18
|
#define I2C1_SDA_PIN 18
|
||||||
// MQTT and WiFi defines
|
// MQTT and WiFi defines
|
||||||
#define ADAFRUIT_IO_HOST "io.adafruit.com"
|
#define ADAFRUIT_IO_HOST "io.adafruit.com"
|
||||||
#define ADAFRUIT_IO_USERNAME "ADAFRUIT_IO_USERNAME"
|
#define ADAFRUIT_IO_PASSWORD ADAFRUIT_IO_KEY
|
||||||
#define ADAFRUIT_IO_PASSWORD "ADAFRUIT_IO_KEY"
|
|
||||||
#define WIFI_SSID "Meosjin"
|
|
||||||
#define WIFI_PASSWORD "WIFI_PASSWORD"
|
|
||||||
#define MQTT_KEEP_ALIVE_SECONDS 60
|
#define MQTT_KEEP_ALIVE_SECONDS 60
|
||||||
|
|
||||||
static void mqtt_connection_cb(mqtt_client_t *client, void *arg,
|
static void mqtt_connection_cb(mqtt_client_t *client, void *arg,
|
||||||
|
|
@ -78,13 +76,14 @@ static uint16_t average_uint16(const uint16_t *samples, uint8_t count) {
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
// MQTT Topics
|
// MQTT Topics
|
||||||
static const char temp_topic[] = "ADAFRUIT_IO_USERNAME/feeds/ensaht.temperature";
|
static const char temp_topic[] =
|
||||||
static const char humi_topic[] = "ADAFRUIT_IO_USERNAME/feeds/ensaht.humidity";
|
ADAFRUIT_IO_USERNAME "/feeds/ensaht.temperature";
|
||||||
static const char aqi_topic[] = "ADAFRUIT_IO_USERNAME/feeds/ensaht.aqi";
|
static const char humi_topic[] = ADAFRUIT_IO_USERNAME "/feeds/ensaht.humidity";
|
||||||
static const char tvoc_topic[] = "ADAFRUIT_IO_USERNAME/feeds/ensaht.tvoc";
|
static const char aqi_topic[] = ADAFRUIT_IO_USERNAME "/feeds/ensaht.aqi";
|
||||||
static const char etoh_topic[] = "ADAFRUIT_IO_USERNAME/feeds/ensaht.etoh";
|
static const char tvoc_topic[] = ADAFRUIT_IO_USERNAME "/feeds/ensaht.tvoc";
|
||||||
static const char eco2_topic[] = "ADAFRUIT_IO_USERNAME/feeds/ensaht.eco2";
|
static const char etoh_topic[] = ADAFRUIT_IO_USERNAME "/feeds/ensaht.etoh";
|
||||||
static const char prs_topic[] = "ADAFRUIT_IO_USERNAME/feeds/ensaht.pressure";
|
static const char eco2_topic[] = ADAFRUIT_IO_USERNAME "/feeds/ensaht.eco2";
|
||||||
|
static const char prs_topic[] = ADAFRUIT_IO_USERNAME "/feeds/ensaht.pressure";
|
||||||
uint16_t tvoc, eco2, etoh, avg_tvoc, avg_eco2, avg_etoh;
|
uint16_t tvoc, eco2, etoh, avg_tvoc, avg_eco2, avg_etoh;
|
||||||
uint8_t aqi, validData;
|
uint8_t aqi, validData;
|
||||||
double t, h, avg_t, avg_h, avg_bmp_t, avg_bmp_p;
|
double t, h, avg_t, avg_h, avg_bmp_t, avg_bmp_p;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue