Skip to content

Commit

Permalink
Fixes for #3
Browse files Browse the repository at this point in the history
Conditional loading of LittleFS.h dependent on processor.
Update example for new button class.
  • Loading branch information
Bodmer committed Aug 13, 2022
1 parent 63146c9 commit 07a570e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
10 changes: 5 additions & 5 deletions examples/Buttons/Button_demo/Button_demo.ino
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Button widget demo, requires display with touch screen
// Button widget demo, requires SPI display with touch screen

// Requires widget library here:
// https://github.com/Bodmer/TFT_eWidget

#include "FS.h"
#include <FS.h>
#include "Free_Fonts.h" // Include the header file attached to this sketch

#include <TFT_eSPI.h> // Hardware-specific library
Expand All @@ -14,15 +14,15 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
#define CALIBRATION_FILE "/TouchCalData1"
#define REPEAT_CAL false

TFT_eWidget btnL = TFT_eWidget(&tft);
TFT_eWidget btnR = TFT_eWidget(&tft);
ButtonWidget btnL = ButtonWidget(&tft);
ButtonWidget btnR = ButtonWidget(&tft);

#define BUTTON_W 100
#define BUTTON_H 50

// Create an array of button instances to use in for() loops
// This is more useful where large numbers of buttons are employed
TFT_eWidget* btn[] = {&btnL , &btnR};;
ButtonWidget* btn[] = {&btnL , &btnR};;
uint8_t buttonCount = sizeof(btn) / sizeof(btn[0]);

void btnL_pressAction(void)
Expand Down
2 changes: 1 addition & 1 deletion examples/Sliders/Slider_demo/Slider_demo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// https://github.com/Bodmer/TFT_eWidget

#include "FS.h"
#include <LittleFS.h>

#include "Free_Fonts.h" // Include the header file attached to this sketch

#include <TFT_eSPI.h>
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "TFT_eWidget",
"version": "0.0.4",
"version": "0.0.5",
"keywords": "Arduino, tft, display, button, gui, graph, meter, slider",
"description": "A TFT GUI widget library",
"repository":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=TFT_eWidget
version=0.0.4
version=0.0.5
author=Bodmer
maintainer=Bodmer
sentence=A TFT GUI widget library
Expand Down
7 changes: 7 additions & 0 deletions src/TFT_eWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
//Standard support
#include <Arduino.h>

// LittleFS is required for touch calibration in TFT_eSPI sketches
#if defined (ESP8266) || defined (ESP32)
#include <pgmspace.h>
#include <FS.h>
#include <LittleFS.h>
#endif

#include <TFT_eSPI.h>

#include "widgets/button/ButtonWidget.h"
Expand Down

0 comments on commit 07a570e

Please sign in to comment.