generated from TDD-Templates/cmake_cpputest_template
Added helper functions for the display
+ init func. + update distance. + update direction. + update battery state. + reset func.
This commit is contained in:
parent
0aebbf09dd
commit
7386e12fb8
|
@ -28,6 +28,10 @@ static int prevHeading = -1; // Store previous heading to avoid frequent
|
||||||
unsigned long lastUpdate = 0; // Time tracking for updates
|
unsigned long lastUpdate = 0; // Time tracking for updates
|
||||||
const int updateInterval = 500; // Update interval in milliseconds (500ms = 0.5s)
|
const int updateInterval = 500; // Update interval in milliseconds (500ms = 0.5s)
|
||||||
|
|
||||||
|
const uint8_t MAX_BATT_PERCENTAGE = 100;
|
||||||
|
const uint8_t MIN_BATT_PERCENTAGE = 0;
|
||||||
|
|
||||||
|
|
||||||
typedef struct MSG{
|
typedef struct MSG{
|
||||||
uint8_t id;
|
uint8_t id;
|
||||||
double latitude;
|
double latitude;
|
||||||
|
@ -168,9 +172,7 @@ void setup(void) {
|
||||||
// Initialize Serial Communication for debugging
|
// Initialize Serial Communication for debugging
|
||||||
Serial.begin(SERIAL_BUADRATE);
|
Serial.begin(SERIAL_BUADRATE);
|
||||||
|
|
||||||
// Display Setup
|
TFT_Init();
|
||||||
tft.init(TFT_X, TFT_Y); // Initialize the display with a resolution of 240x280 pixels
|
|
||||||
tft.fillScreen(ST77XX_BLACK); // Set the screen background to black
|
|
||||||
|
|
||||||
// Magnetometer Setup
|
// Magnetometer Setup
|
||||||
if (!lis2mdl.begin()) { // Initialize the magnetometer
|
if (!lis2mdl.begin()) { // Initialize the magnetometer
|
||||||
|
@ -262,6 +264,48 @@ void updateLEDs(int heading) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Updates the distance part of the display
|
||||||
|
void TFT_UpdateDistance(uint16_t meters) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Updates the direction part of the display
|
||||||
|
void TFT_UpdateDirection() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Updates the batter/voltage state.
|
||||||
|
uint8_t TFT_UpdateBatteryState(uint8_t percentage) {
|
||||||
|
if(percentage > MAX_BATT_PERCENTAGE || percentage < MIN_BATT_PERCENTAGE){
|
||||||
|
return Err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Displays the specifications of the node.
|
||||||
|
void TFT_DisplaySpecs(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Resets the the display
|
||||||
|
uint8_t TFT_Reset() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initalizes the Screen with default startup screen.
|
||||||
|
uint8_t TFT_Init(void) {
|
||||||
|
// Display Setup
|
||||||
|
tft.init(TFT_X, TFT_Y); // Initialize the display with a resolution of 240x280 pixels
|
||||||
|
tft.fillScreen(ST77XX_BLACK); // Set the screen background to black
|
||||||
|
|
||||||
|
TFT_UpdateDistance(0);
|
||||||
|
TFT_UpdateDirection(0);
|
||||||
|
TFT_UpdateBatteryState(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Placeholder for updating the TFT display with GPS data
|
// Placeholder for updating the TFT display with GPS data
|
||||||
void updateDisplay() {
|
void updateDisplay() {
|
||||||
// Disable interrupts while using the dispaly.
|
// Disable interrupts while using the dispaly.
|
||||||
|
|
Loading…
Reference in New Issue