Skip to content

Commit 4ba4f25

Browse files
committed
fixed icon in the webui, other headless fixes (pr3y#107)
1 parent ad7468e commit 4ba4f25

File tree

6 files changed

+74
-21
lines changed

6 files changed

+74
-21
lines changed

src/core/mykeyboard.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ bool checkSelPress(){
5555
#if defined (CARDPUTER)
5656
Keyboard.update();
5757
if(Keyboard.isKeyPressed(KEY_ENTER) || digitalRead(0)==LOW)
58-
//#elif defined(NEW_DEVICE)
59-
58+
#elif ! defined(HAS_SCREEN)
59+
// always return false
60+
if(false)
6061
#else
6162
if(digitalRead(SEL_BTN)==LOW)
6263
#endif
@@ -131,9 +132,8 @@ int checkNumberShortcutPress() {
131132
}
132133
// else
133134
return -1;
134-
#endif
135135
}
136-
136+
#endif
137137

138138
/* Starts keyboard to type data */
139139
String keyboard(String mytext, int maxSize, String msg) {

src/core/serialcmds.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ void handleSerialCommands() {
8686

8787
//log_d(cmd_str.c_str());
8888
cmd_str.trim();
89-
//cmd_str.toLowerCase(); // case-insensitive matching -> issue with filenames
89+
// case-insensitive matching only without filename args -- TODO: better solution for this
90+
if(cmd_str.indexOf("from_file ") == -1)
91+
cmd_str.toLowerCase();
9092

9193
processSerialCommand(cmd_str);
9294
}
@@ -100,6 +102,9 @@ bool processSerialCommand(String cmd_str) {
100102
}
101103

102104
if(cmd_str.startsWith("ir") ) {
105+
106+
gsetIrTxPin(false);
107+
//if(IrTx==0) IrTx = LED; // quickfix init issue? CARDPUTER is 44
103108

104109
// ir tx <protocol> <address> <command>
105110
// <protocol>: NEC, NECext, NEC42, NEC42ext, Samsung32, RC6, RC5, RC5X, SIRC, SIRC15, SIRC20, Kaseikyo, RCA
@@ -124,7 +129,8 @@ bool processSerialCommand(String cmd_str) {
124129
sendRC6Command(address, command);
125130
return true;
126131
}
127-
// TODO: more protocols: Samsung32, SIRC
132+
//if(cmd_str.startsWith("ir tx sirc")){
133+
//if(cmd_str.startsWith("ir tx samsung")){
128134

129135
//if(cmd_str.startsWith("ir tx raw")){
130136

@@ -144,7 +150,6 @@ bool processSerialCommand(String cmd_str) {
144150
// e.g. IRSend {"Protocol":"NEC","Bits":32,"Data":"0x20DF10EF"}
145151
// TODO: rewrite using ArduinoJson parser?
146152
// TODO: decode "data" into "address, command" and use existing "send*Command" funcs
147-
if(IrTx==0) IrTx = LED; // quickfix init issue? CARDPUTER is 44
148153

149154
//IRsend irsend(IrTx); //inverted = false
150155
//Serial.println(IrTx);
@@ -197,7 +202,9 @@ bool processSerialCommand(String cmd_str) {
197202
} // end of ir commands
198203

199204
if(cmd_str.startsWith("rf") || cmd_str.startsWith("subghz" )) {
200-
if(RfTx==0) RfTx=GROVE_SDA; // quick fix
205+
206+
gsetRfTxPin(false);
207+
//if(RfTx==0) RfTx=GROVE_SDA; // quick fix
201208
pinMode(RfTx, OUTPUT);
202209
//Serial.println(RfTx);
203210

src/modules/ir/TV-B-Gone.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,8 @@ void otherIRcodes() {
499499
if(checkEscPress() || exit) break;
500500
delay(200);
501501
}
502+
503+
returnToMenu=true;
502504
} // end of otherIRcodes
503505

504506

src/modules/others/webInterface.cpp

+19-3
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ String listFiles(FS fs, bool ishtml, String folder, bool isLittleFS) {
130130
returnText += "<td style=\"font-size: 10px; text-align=center;\">" + humanReadableSize(foundfile.size()) + "</td>\n";
131131
returnText += "<td><i class=\"gg-arrow-down-r\" onclick=\"downloadDeleteButton(\'"+ String(foundfile.path()) + "\', \'download\')\"></i>&nbsp&nbsp\n";
132132
//if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("bin")) returnText+= "<i class=\"gg-arrow-up-r\" onclick=\"startUpdate(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
133-
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("sub")) returnText+= "<i class=\"gg-arrow-up-r\" onclick=\"sendSubFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
134-
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("ir")) returnText+= "<i class=\"gg-arrow-up-r\" onclick=\"sendIrFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
133+
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("sub")) returnText+= "<i class=\"gg-data\" onclick=\"sendSubFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
134+
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("ir")) returnText+= "<i class=\"gg-data\" onclick=\"sendIrFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
135135
#if defined(USB_as_HID)
136-
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("txt")) returnText+= "<i class=\"gg-arrow-up-r\" onclick=\"sendBadusbFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
136+
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("txt")) returnText+= "<i class=\"gg-data\" onclick=\"sendBadusbFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
137137
#endif
138138
returnText += "<i class=\"gg-rename\" onclick=\"renameFile(\'" + String(foundfile.path()) + "\', \'" + String(foundfile.name()) + "\')\"></i>&nbsp&nbsp\n";
139139
returnText += "<i class=\"gg-trash\" onclick=\"downloadDeleteButton(\'" + String(foundfile.path()) + "\', \'delete\')\"></i></td></tr>\n\n";
@@ -255,6 +255,22 @@ void configureWebServer() {
255255
// Index page
256256
server->on("/", HTTP_GET, []() {
257257
if (checkUserWebAuth()) {
258+
// WIP: custom webui page serving
259+
/*
260+
FS* fs = NULL;
261+
File custom_index_html_file = NONE;
262+
if(SD.exists("/webui.html")) fs = &SD;
263+
if(LittleFS.exists("/webui.html")) fs = &LittleFS;
264+
if(fs) {
265+
// try to read the custom page and serve that
266+
File custom_index_html_file = fs->open("/webui.html", FILE_READ);
267+
if(custom_index_html_file) {
268+
// read the whole file
269+
//server->send(200, "text/html", processor(custom_index_html));
270+
}
271+
}
272+
*/
273+
// just serve the hardcoded page
258274
server->send(200, "text/html", processor(index_html));
259275
} else {
260276
server->requestAuthentication();

src/modules/others/webInterface.h

+37-10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const char index_html[] PROGMEM = R"rawliteral(
2727
<meta charset="UTF-8">
2828

2929
<!-- CSS sample thanks to @im.nix (Discord) -->
30+
<!-- MEMO: more icons available here https://css.gg/app -->
3031
<style>
3132
.gg-rename {
3233
box-sizing: border-box;
@@ -136,16 +137,42 @@ const char index_html[] PROGMEM = R"rawliteral(
136137
top: -7px;
137138
left: -2px
138139
}
139-
.gg-arrow-up-r {
140-
box-sizing: border-box;
141-
position: relative;
142-
display: inline-block;
143-
width: 22px;
144-
height: 22px;
145-
border: 2px solid;
146-
transform: scale(var(--ggs,1));
147-
cursor: pointer;
148-
border-radius: 4px
140+
.gg-data {
141+
transform: scale(var(--ggs,1))
142+
}
143+
.gg-data,
144+
.gg-data::after,
145+
.gg-data::before {
146+
box-sizing: border-box;
147+
position: relative;
148+
display: block;
149+
border: 2px solid;
150+
border-radius: 50%;
151+
width: 14px;
152+
height: 14px
153+
}
154+
.gg-data::after,
155+
.gg-data::before {
156+
content: "";
157+
position: absolute;
158+
width: 6px;
159+
height: 6px;
160+
top: 2px;
161+
left: 2px
162+
}
163+
.gg-data::after {
164+
background: linear-gradient( to left,
165+
currentColor 8px,transparent 0)
166+
no-repeat bottom center/2px 8px;
167+
width: 22px;
168+
height: 22px;
169+
top: -6px;
170+
left: -6px
171+
}
172+
.gg-data,
173+
.gg-data::after {
174+
border-top-color: transparent;
175+
border-bottom-color: transparent
149176
}
150177
.gg-arrow-down-r {
151178
box-sizing: border-box;

src/modules/rf/rf.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ void otherRFcodes() {
688688
if(filepath=="") return; // cancelled
689689
// else
690690
txSubFile(fs, filepath);
691+
returnToMenu=true;
691692
}
692693

693694

0 commit comments

Comments
 (0)