chore(constants): extract constants into separate header

This commit is contained in:
2026-04-29 00:46:06 +02:00
parent ea3632326b
commit 6fffa3e879
7 changed files with 24 additions and 17 deletions
+10
View File
@@ -0,0 +1,10 @@
#pragma once
/*
* A header file to store all the constants used in the project.
*/
#define LCD_I2C_ADDRESS 0x27
#define LCD_COLS 20
#define LCD_ROWS 4
#define ACTION_INTERVAL 60000 // 1 minute
#define MAXIMUM_STAT 100
+2 -3
View File
@@ -1,6 +1,7 @@
#pragma once
#include <Arduino.h>
#include <LiquidCrystal_I2C.h>
#include "constants.hpp"
#include "menu.hpp"
/*
@@ -8,7 +9,7 @@
*/
class Display {
public:
Display(uint8_t addr = 0x27, uint8_t cols = 20, uint8_t rows = 4);
Display();
void begin();
void clear();
@@ -17,7 +18,5 @@ class Display {
LiquidCrystal_I2C& getLCD();
private:
uint8_t rows;
uint8_t cols;
LiquidCrystal_I2C lcd;
};
-2
View File
@@ -4,8 +4,6 @@
#include "display.hpp"
#include "menu.hpp"
#include "pet.hpp"
#define ACTION_INTERVAL 60000 // 1 minute
#define MAXIMUM_STAT 100
typedef struct {
Pet pet;
+2 -2
View File
@@ -1,6 +1,6 @@
#pragma once
#define MENU_ITEM_COUNT 4
#include <Arduino.h>
#include "constants.hpp"
#include "joystick.hpp"
class Menu {
@@ -12,6 +12,6 @@ class Menu {
String& getItemAt(size_t index);
size_t getCurrentItemIndex() const;
private:
String items[MENU_ITEM_COUNT];
String items[LCD_ROWS];
int currentItem;
};