Skip to content

Commit

Permalink
Merge branch 'main' into spiffs_browser_limitations_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
frostmorn committed Mar 21, 2024
2 parents 6101759 + dc9203f commit 0b6cc7d
Show file tree
Hide file tree
Showing 27 changed files with 292 additions and 159 deletions.
2 changes: 1 addition & 1 deletion docs/keira/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Keira підтримує запуск другорядних прошивок з
- Вам не потрібно щоразу перепрошивати Лілку, щоб випробувати другорядні прошивки: просто скопіюйте їх на SD-картку.
- Ви можете ділитися своїми скомпільованими прошивками (у вигляді ``.bin``-файлів) з іншими користувачами Лілки, без необхідності відправляти їм весь код вашої власної прошивки.

Найяскравіший приклад використання цієї функції - запуск Doom. Достатньо скопіювати в корінь SD-карти файли ``doom.bin`` і ``doom.wad`` (або ``doom1.wad``), і ви зможете грати в Doom!
Найяскравіший приклад використання цієї функції - запуск Doom. Достатньо скопіювати на SD-карту файли ``doom.bin`` і ``doom.wad`` (або ``doom1.wad``), і ви зможете грати в Doom!

.. note:: Щоб отримати ``doom.bin``, вам потрібно скомпілювати прошивку, що знаходиться в папці ``firmware/doom``, і тоді скопіювати файл ``doom.bin`` на SD-картку.

Expand Down
4 changes: 2 additions & 2 deletions docs/keira/lua/reference/lilka.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

Ви повинні визначити її в своєму коді, якщо ви хочете використовувати її для оновлення вашої програми.

.. lua:function:: render()
.. lua:function:: draw()
Ця функція автоматично викликається після `lilka.update`. Тут відбувається відображення графіки.

Expand All @@ -32,4 +32,4 @@
.. lua:autoclass:: lilka
.. Does not work with aliases... So we have to copy-paste the stuff above.
.. :members: init, update, render
.. :members: init, update, draw
2 changes: 1 addition & 1 deletion firmware/doom/.gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lib/doomgeneric/** linguist-vendored
lib/** linguist-vendored
21 changes: 17 additions & 4 deletions firmware/doom/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,22 @@ void setup() {
char arg[] = "doomgeneric";
char arg2[] = "-iwad";
char arg3[64];

// Get firmware arg
String firmwareFile = lilka::multiboot.getFirmwarePath();
lilka::serial_log("Firmware file: %s\n", firmwareFile.c_str());
String firmwareDir;
if (firmwareFile.length()) {
// Get directory from firmware file
int lastSlash = firmwareFile.lastIndexOf('/');
firmwareDir = firmwareFile.substring(0, lastSlash);
} else {
firmwareDir = "/";
}

bool found = false;
// Find the wad file
File root = SD.open("/");
// Find the WAD file
File root = SD.open(firmwareDir.c_str());
File file;
while ((file = root.openNextFile())) {
if (file.isDirectory()) {
Expand All @@ -118,7 +131,7 @@ void setup() {
name.toLowerCase();
lilka::serial_log("Checking file: %s\n", name.c_str());
if (name.startsWith("doom") && name.endsWith(".wad")) {
strcpy(arg3, (String("/sd/") + file.name()).c_str());
strcpy(arg3, (String("/sd") + firmwareDir + "/" + file.name()).c_str());
lilka::serial_log("Found .WAD file: %s\n", arg3);
found = true;
file.close();
Expand All @@ -130,7 +143,7 @@ void setup() {
if (!found) {
lilka::Alert alert("Doom", "Не знайдено .WAD-файлу на картці пам'яті");
alert.draw(&lilka::display);
while (!alert.isDone()) {
while (!alert.isFinished()) {
alert.update();
}
esp_restart();
Expand Down
1 change: 1 addition & 0 deletions firmware/keira/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/** linguist-vendored
4 changes: 2 additions & 2 deletions firmware/keira/lib/SimpleFTPServer/src/FtpServerKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ However, the last one, that will break anything that uses the ESP32 WiFi library
#define FTP_TIME_OUT 5 * 60


// Wait for authentication for 10 seconds (expressed in seconds)
#define FTP_AUTH_TIME_OUT 10
// Wait for authentication for 30 seconds (expressed in seconds)
#define FTP_AUTH_TIME_OUT 30


// Size of file buffer for read/write
Expand Down
2 changes: 1 addition & 1 deletion firmware/keira/sdcard/counter/counter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ state.counter = state.counter + 1
display.fill_screen(display.color565(64, 0, 64))
display.set_cursor(0, 64)
display.print('Лічильник запусків\nпрограми: ', state.counter)
display.render()
display.queue_draw()
util.sleep(0.5)
7 changes: 3 additions & 4 deletions firmware/keira/sdcard/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ for i = 10, 1, -1 do
local y = math.random(280 - 64)
display.draw_image(face, x, y)

display.render()
display.queue_draw()

util.sleep(0.25)
end

-- Now, we want to draw random lines & faces really fast directly to display, without any buffering!
display.set_buffered(false)

local key = controller.get_state()
while not key.a.just_pressed do
local x1 = math.random(240)
Expand All @@ -34,5 +31,7 @@ while not key.a.just_pressed do
local y = math.random(280 - 64)
display.draw_image(face, x, y)

display.queue_draw()

key = controller.get_state()
end
1 change: 0 additions & 1 deletion firmware/keira/src/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
keira_splash.h linguist-generated
apps/icons/*.h linguist-generated
apps/mjs/mjs.* linguist-vendored
4 changes: 2 additions & 2 deletions firmware/keira/src/apps/demos/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void KeyboardApp::run() {
dialog.update();
dialog.draw(canvas);
queueDraw();
if (dialog.isDone()) {
if (dialog.isFinished()) {
break;
}
}
Expand All @@ -20,7 +20,7 @@ void KeyboardApp::run() {
queueDraw();
while (true) {
alert.update();
if (alert.isDone()) {
if (alert.isFinished()) {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion firmware/keira/src/apps/demos/letris.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ void LetrisApp::run() {
queueDraw();
while (1) {
alert.update();
if (alert.isDone()) {
if (alert.isFinished()) {
break;
}
taskYIELD();
Expand Down
2 changes: 1 addition & 1 deletion firmware/keira/src/apps/demos/scan_i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void ScanI2CApp::run() {
lilka::Alert alert("Помилка", "Ця програма потребує Лілку версії 2 або вище.");
alert.draw(canvas);
queueDraw();
while (!alert.isDone()) {
while (!alert.isFinished()) {
alert.update();
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion firmware/keira/src/apps/demos/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void TransformApp::run() {
lilka::Alert alert("Помилка", "Не вдалось завантажити face.bmp з SD-карти.");
alert.draw(canvas);
queueDraw();
while (!alert.isDone()) {
while (!alert.isFinished()) {
alert.update();
}
return;
Expand Down
Loading

0 comments on commit 0b6cc7d

Please sign in to comment.