Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
Minor fix and replaced SPIFFS support to LittleFS
  • Loading branch information
4D Systems committed Dec 10, 2020
1 parent 57de0ab commit 43b48e8
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 28 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=GFX4d
version=1.0.0
version=1.0.1
author=4D Systems Pty Ltd
maintainer=4D Systems Pty Ltd <[email protected]>
sentence=Graphics Library for the gen4-IoD by 4D Systems
Expand Down
61 changes: 61 additions & 0 deletions src/Examples/IoDkBTestAuto/data/IODKBT~1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"Keyboard1" 0000 0000 00 4B
"Keyboard1_0" 3A00 0003 01 4C
"Keyboard1_1" 5000 0003 16 4C
"Keyboard1_2" 6600 0003 2B 4C
"Keyboard1_3" 7C00 0003 40 4C
"Keyboard1_4" 9200 0003 56 4C
"Keyboard1_5" A800 0003 6B 4C
"Keyboard1_6" BE00 0003 80 4C
"Keyboard1_7" D400 0003 95 4C
"Keyboard1_8" EA00 0003 AB 4C
"Keyboard1_9" 0000 0004 C0 4C
"Keyboard1_10" 1600 0004 D5 4C
"Keyboard1_11" 2C00 0004 EA 4C
"Keyboard1_12" 4200 0004 100 4C
"Keyboard1_13" 5800 0004 115 4C
"Keyboard1_14" 8600 0004 01 6C
"Keyboard1_15" A800 0004 20 6C
"Keyboard1_16" BE00 0004 36 6C
"Keyboard1_17" D400 0004 4B 6C
"Keyboard1_18" EA00 0004 60 6C
"Keyboard1_19" 0000 0005 75 6C
"Keyboard1_20" 1600 0005 8B 6C
"Keyboard1_21" 2C00 0005 A0 6C
"Keyboard1_22" 4200 0005 B5 6C
"Keyboard1_23" 5800 0005 CB 6C
"Keyboard1_24" 6E00 0005 E0 6C
"Keyboard1_25" 8400 0005 F5 6C
"Keyboard1_26" 9A00 0005 10A 6C
"Keyboard1_27" B000 0005 120 6C
"Keyboard1_28" D200 0005 01 8D
"Keyboard1_29" FA00 0005 26 8D
"Keyboard1_30" 1000 0006 3B 8D
"Keyboard1_31" 2600 0006 50 8D
"Keyboard1_32" 3C00 0006 66 8D
"Keyboard1_33" 5200 0006 7B 8D
"Keyboard1_34" 6800 0006 90 8D
"Keyboard1_35" 7E00 0006 A5 8D
"Keyboard1_36" 9400 0006 BB 8D
"Keyboard1_37" AA00 0006 D0 8D
"Keyboard1_38" C000 0006 E5 8D
"Keyboard1_39" D600 0006 FA 8D
"Keyboard1_40" EC00 0006 110 8D
"Keyboard1_41" 1E00 0007 01 AE
"Keyboard1_42" 4C00 0007 2B AE
"Keyboard1_43" 6200 0007 40 AE
"Keyboard1_44" 7800 0007 56 AE
"Keyboard1_45" 8E00 0007 6B AE
"Keyboard1_46" A400 0007 80 AE
"Keyboard1_47" BA00 0007 95 AE
"Keyboard1_48" D000 0007 AB AE
"Keyboard1_49" E600 0007 C0 AE
"Keyboard1_50" FC00 0007 D5 AE
"Keyboard1_51" 1200 0008 EA AE
"Keyboard1_52" 2800 0008 100 AE
"Keyboard1_53" 6C00 0008 01 CF
"Keyboard1_54" 9400 0008 46 CF
"Keyboard1_55" 1A00 0009 DA CF
"Keyboard1_56" 4200 0009 100 CF
"Keyboard1_57" 5800 0009 115 CF
"Keyboard1_58" 6400 0009 115 DF
"Keyboard1_59" 7000 0009 12A CF
Binary file added src/Examples/IoDkBTestAuto/data/IODKBT~1.gci
Binary file not shown.
82 changes: 58 additions & 24 deletions src/GFX4d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
#endif

#ifdef USE_FS
#include <FS.h>
//#include <FS.h>
#include "LittleFS.h"
#endif

GFX4d::GFX4d(){
Expand Down Expand Up @@ -324,19 +325,22 @@ void GFX4d::begin(void) {
#endif
Cls(0);
#ifndef USE_FS
#ifndef ESP32
//#ifndef ESP32
//#ifdef SDFS_H
if(SD.begin(_sd, spiSettings)){
//#else
//if(SD.begin(_sd, 79000000)){
//#endif
//#else
//if(SD.begin(_sd, SPI, 79000000)){
//#endif
#else
if(SD.begin(_sd, SPI, 79000000)){
#endif
#else
if(SPIFFS.begin()){
if(LittleFS.begin()){
//if(SPIFFS.begin()){
#endif
sdok = true;
//print("FS Ok");
//delay(1000);
} else {
sdok = false;
}
Expand Down Expand Up @@ -1049,7 +1053,7 @@ void GFX4d::PrintImageFile(String ifile){
#ifndef USE_FS
dataFile = SD.open(ifile);
#else
dataFile = SPIFFS.open((char*)ifile.c_str(), "r");
dataFile = LittleFS.open((char*)ifile.c_str(), "r");
#endif
if(!dataFile){
return;
Expand Down Expand Up @@ -1214,22 +1218,22 @@ void GFX4d::Open4dGFX(String file4d){
gciobjnum = 0;
imageTouchEnable(-1, false);
String inputString;
#ifndef ESP32
dat4d = file4d + ".dat";
gci4d = file4d + ".gci";
#else
#ifndef USE_FS
dat4d = "/" + file4d + ".dat";
gci4d = "/" + file4d + ".gci";
#else
//#ifndef ESP32
//dat4d = file4d + ".dat";
//gci4d = file4d + ".gci";
//#else
//#ifndef USE_FS
//dat4d = "/" + file4d + ".dat";
//gci4d = "/" + file4d + ".gci";
//#else
dat4d = file4d + ".dat";
gci4d = file4d + ".gci";
#endif
#endif
//#endif
//#endif
#ifndef USE_FS
userDat = SD.open(dat4d);
#else
userDat = SPIFFS.open((char*)dat4d.c_str(), "r");
userDat = LittleFS.open((char*)dat4d.c_str(), "r");
#endif
if(userDat){
char c;
Expand Down Expand Up @@ -1264,7 +1268,7 @@ void GFX4d::Open4dGFX(String file4d){
#ifndef USE_FS
userImag = SD.open(gci4d);
#else
userImag = SPIFFS.open((char*)gci4d.c_str(), "r");
userImag = LittleFS.open((char*)gci4d.c_str(), "r");
#endif
uint32_t tIndex;
int coldepth;
Expand Down Expand Up @@ -3044,7 +3048,7 @@ void GFX4d::touch_Set(uint8_t mode) {
#else
SPI.beginTransaction(spiSettingsT32);
#endif
if(mode == TOUCH_DISABLE){
//if(mode == TOUCH_DISABLE){
tchen = false;
digitalWrite(_tcs, LOW);
delayMicroseconds(50);
Expand All @@ -3059,14 +3063,44 @@ void GFX4d::touch_Set(uint8_t mode) {
delayMicroseconds(50);
}
digitalWrite(_tcs, HIGH);
}
//}
if(mode == TOUCH_ENABLE){
tchen = true;
digitalWrite(_tcs, LOW);
SPI.write(0x55);
delayMicroseconds(50);
SPI.write(0x01);
delayMicroseconds(50);
SPI.write(0x22);
for(int s = 0; s < 5; s++){
dat = SPI.transfer(0);
delayMicroseconds(50);
}
SPI.write(0x55);
delayMicroseconds(50);
SPI.write(0x05);
delayMicroseconds(50);
SPI.write(0x21);
delayMicroseconds(50);
SPI.write(0x00);
delayMicroseconds(50);
SPI.write(dat + 0x03);
delayMicroseconds(50);
SPI.write(0x01);
delayMicroseconds(50);
SPI.write(T_SENSE);
delayMicroseconds(50);
for(int s = 0; s < 4; s++){
dat = SPI.transfer(0);
delayMicroseconds(50);
}
//delayMicroseconds(50);
//SPI.write(T_SENSE);
delayMicroseconds(50);
SPI.write(0x55);
delayMicroseconds(50);
SPI.write(0x01);
delayMicroseconds(50);
SPI.write(ENABLE_TOUCH);
delayMicroseconds(50);
for(int s = 0; s < 4; s++){
Expand Down Expand Up @@ -3592,10 +3626,10 @@ void GFX4d::Download(String Address, uint16_t port, String hfile, String Fname,
}
Dwnload = SD.open((char*)Fname.c_str(), FILE_WRITE);
#else
if(SPIFFS.exists((char*)Fname.c_str())) {
SPIFFS.remove((char*)Fname.c_str());
if(LittleFS.exists((char*)Fname.c_str())) {
LittleFS.remove((char*)Fname.c_str());
}
Dwnload = SPIFFS.open((char*)Fname.c_str(), "w");
Dwnload = LittleFS.open((char*)Fname.c_str(), "w");
#endif
int32_t lens = http.getSize();
if(lens == 0){
Expand Down
8 changes: 5 additions & 3 deletions src/GFX4d.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@
//#include <SDFS.h>
#include <SD.h>
#else
#define FS_NO_GLOBALS //allow spiffs to coexist with SD card, define BEFORE including FS.h
#include <FS.h> //spiff file system
//#define FS_NO_GLOBALS //allow spiffs to coexist with SD card, define BEFORE including FS.h
#include <LittleFS.h> //spiff file system
#endif
#ifdef ESP32
#define M5STACK
Expand Down Expand Up @@ -287,6 +287,7 @@
#define SLIDER_RAISED 0
#define SLIDER_SUNKEN 1
#define NOTOUCH 0
#define T_SENSE 10
#define TOUCH_PRESSED 1
#define TOUCH_RELEASED 2
#define TOUCH_STATUS 0
Expand Down Expand Up @@ -1015,6 +1016,7 @@ boolean draw, uint32_t bgindex),
//gradofs;
uint16_t lastArcOld[MAX_ARCSIZE],
inx[MAX_ARCSIZE];
boolean sdok;

protected:

Expand Down Expand Up @@ -1114,7 +1116,7 @@ boolean draw, uint32_t bgindex),
twframe,
butchnge,
dlok,
sdok,
//sdok,
gciobjtouchenable[MAX_WIDGETS],
scrolled,
nl,
Expand Down

0 comments on commit 43b48e8

Please sign in to comment.