Skip to content

Commit

Permalink
A little tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
o0shojo0o committed Jan 9, 2025
1 parent 7a7f0f9 commit f2c01ca
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
content = "const char mainPage[] PROGMEM = R\"=====(" + content + ")=====\";"

# Write the content of the file
webuih = open('./src/Webinterface.h', 'w')
webuih = open('./include/Webinterface.h', 'w')
webuih.write(content)
webuih.close()

14 changes: 14 additions & 0 deletions include/BtnActions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef BTNACTIONS_H
#define BTNACTIONS_H

enum btnActions
{
btnAction_DoNothing = 0,
btnAction_GotoClock = 1,
btnAction_ToggleSleepMode = 2,
btnAction_MP3PlayPause = 3,
btnAction_MP3PlayPrevious = 4,
btnAction_MP3PlayNext = 5,
};

#endif // BTNACTIONS_H
11 changes: 11 additions & 0 deletions include/BtnStates.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef BTNSTATES_H
#define BTNSTATES_H

enum btnStates
{
btnState_Released,
btnState_PressedNew,
btnState_PressedBefore,
};

#endif // BTNSTATES_H
File renamed without changes.
11 changes: 11 additions & 0 deletions include/LuxSensor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef LUXSENSOR_H
#define LUXSENSOR_H

enum LuxSensor
{
LuxSensor_LDR,
LuxSensor_BH1750,
LuxSensor_Max44009,
};

#endif // LUXSENSOR_H
File renamed without changes.
14 changes: 14 additions & 0 deletions include/TempSensor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef TEMPSENSOR_H
#define TEMPSENSOR_H

enum TempSensor
{
TempSensor_None,
TempSensor_BME280,
TempSensor_DHT,
TempSensor_BME680,
TempSensor_BMP280,
TempSensor_SHT31,
};

#endif // TEMPSENSOR_H
10 changes: 10 additions & 0 deletions include/TemperatureUnit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef TEMPERATUREUNIT_H
#define TEMPERATUREUNIT_H

enum TemperatureUnit
{
TemperatureUnit_Celsius,
TemperatureUnit_Fahrenheit
};

#endif // TEMPERATUREUNIT_H
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions include/Version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef VERSION_H
#define VERSION_H

typedef struct
{
int major;
int minor;
int patch;
char prerelease[16];
} Version;

#endif // VERSION_H
File renamed without changes.
52 changes: 6 additions & 46 deletions src/PixelIt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
#include "Tools.h"
#include "UpdateScreen.h"
#include "Liveview.h"
#include "BtnActions.h"
#include "BtnStates.h"
#include "TempSensor.h"
#include "TemperatureUnit.h"
#include "LuxSensor.h"
#include "Version.h"

// Internal Config
#define CHECKUPDATE_INTERVAL 1000 * 60 * 6 * 8 // 8 Hours
Expand Down Expand Up @@ -129,29 +135,12 @@ unsigned long batteryLevelPrevMillis = 0;

int btnPressedLevel[] = {LOW, LOW, LOW};

enum btnStates
{
btnState_Released,
btnState_PressedNew,
btnState_PressedBefore,
};

const String btnAPINames[]{"leftButton", "middleButton", "rightButton"};
const String btnLogNames[]{"Left button", "Middle button", "Right button"};

btnStates btnState[] = {btnState_Released, btnState_Released, btnState_Released};
bool btnLastPublishState[] = {false, false, false};

enum btnActions
{
btnAction_DoNothing = 0,
btnAction_GotoClock = 1,
btnAction_ToggleSleepMode = 2,
btnAction_MP3PlayPause = 3,
btnAction_MP3PlayPrevious = 4,
btnAction_MP3PlayNext = 5,
};

#if defined(ULANZI)
String btnPin[] = {"GPIO_NUM_26", "GPIO_NUM_27", "GPIO_NUM_14"}; // UlanziTC001 workaround to tweak WebUI
bool btnEnabled[] = {true, true, true};
Expand Down Expand Up @@ -185,35 +174,14 @@ unsigned long lastBME680read = 0;
DHTesp dht;

// TempSensor
enum TempSensor
{
TempSensor_None,
TempSensor_BME280,
TempSensor_DHT,
TempSensor_BME680,
TempSensor_BMP280,
TempSensor_SHT31,
};
TempSensor tempSensor = TempSensor_None;

// TemperatureUnit
enum TemperatureUnit
{
TemperatureUnit_Celsius,
TemperatureUnit_Fahrenheit
};
TemperatureUnit temperatureUnit = TemperatureUnit_Celsius;

LightDependentResistor *photocell;
BH1750 *bh1750;
Max44009 *max44009;

enum LuxSensor
{
LuxSensor_LDR,
LuxSensor_BH1750,
LuxSensor_Max44009,
};
LuxSensor luxSensor = LuxSensor_LDR;

FastLED_NeoMatrix *matrix;
Expand Down Expand Up @@ -348,14 +316,6 @@ unsigned long checkUpdateScreenPrevMillis = 0;
unsigned long checkUpdatePrevMillis = 0;
String lastReleaseVersion = VERSION;

typedef struct
{
int major;
int minor;
int patch;
char prerelease[16];
} Version;

// MP3Player Vars
String OldGetMP3PlayerInfo;

Expand Down

0 comments on commit f2c01ca

Please sign in to comment.