Skip to content

Commit

Permalink
sorting by date modified/az in file panel. layer count in print statu…
Browse files Browse the repository at this point in the history
…s. build workflow.
  • Loading branch information
ballaswag committed Dec 19, 2023
1 parent 04afac3 commit 689aba4
Show file tree
Hide file tree
Showing 25 changed files with 896 additions and 150 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,35 @@ name: guppy build

on:
push:
branches: [ "dev_workflow" ]
branches: [ "dev", "main" ]
pull_request:
branches: [ "dev_workflow" ]
branches: [ "main" ]

jobs:
build:
strategy:
matrix:
arch: [mips-linux-gnu-, aarch64-none-linux-gnu-]
theme: [zbolt, material]

runs-on: ubuntu-22.04
container: ballaswag/guppydev:latest
container:
image: ballaswag/guppydev:latest
options: --user 1001

env:
CROSS_COMPILE: ${{ matrix.arch }}
GUPPY_THEME: ${{ matrix.theme }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: |
echo "CROSS_COMPILE=mips-linux-gnu-" >> $GITHUB_ENV

- name: set guppyscreen version
run: |
chmod +x ./version.sh
./version.sh >> $GITHUB_ENV
- name: patch lv_drivers
run: |
Expand All @@ -37,7 +51,12 @@ jobs:
- name: make guppyscreen
run: make -j

- name: package release
run: |
chmod +x ./release.sh
./release.sh >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: guppyscreen
path: build/bin/guppyscreen
name: ${{ env.GUPPY_ARCHIVE_NAME }}
path: ./${{ env.GUPPY_ARCHIVE_NAME }}.tar.gz
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ include $(LVGL_DIR)/lv_drivers/lv_drivers.mk

CSRCS += $(wildcard $(LVGL_DIR)/assets/*.c)

ifdef ZBOLT
ifeq ($(GUPPY_THEME),zbolt)
CSRCS += $(wildcard $(LVGL_DIR)/assets/zbolt/*.c)
DEFINES += -D ZBOLT
else
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.14
302 changes: 302 additions & 0 deletions assets/material/layers_img.c

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/material_svg/layers_img.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
302 changes: 302 additions & 0 deletions assets/zbolt/layers_img.c

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ if [ "$confirm_decreality" = "y" -o "$confirm_decreality" = "Y" ]; then
rm /etc/init.d/S99start_app
else
# disables only display-server and Monitor
cp $K1_GUPPY_DIR/k1_mods/S99start_app /etc/init.d/S99start_app
mv /usr/bin/Monitor /usr/bin/Monitor.disable
mv /usr/bin/display-server /usr/bin/display-server.disable
fi

printf "${green}Setting up GuppyScreen ${white}\n"
Expand Down
2 changes: 2 additions & 0 deletions reinstall-creality.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ BACKUP_DIR=/usr/data/guppyify-backup
cp $BACKUP_DIR/S12boot_display /etc/init.d/S12boot_display
cp $BACKUP_DIR/S50dropbear /etc/init.d/S50dropbear
cp $BACKUP_DIR/S99start_app /etc/init.d/S99start_app
mv /usr/bin/Monitor.disable /usr/bin/Monitor
mv /usr/bin/display-server.disable /usr/bin/display-server
rm /etc/init.d/S99guppyscreen

killall guppyscreen
Expand Down
31 changes: 31 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

RELEASES_DIR=./releases/guppyscreen
rm -rf $RELEASES_DIR

mkdir -p $RELEASES_DIR
"$CROSS_COMPILE"strip ./build/bin/guppyscreen
cp ./build/bin/guppyscreen $RELEASES_DIR/guppyscreen
cp -r ./k1/k1_mods $RELEASES_DIR
cp -r ./k1/scripts $RELEASES_DIR
cp ./installer.sh $RELEASES_DIR
cp reinstall-creality.sh $RELEASES_DIR

if [ x"$CROSS_COMPILE" == x"mips-linux-gnu-" ]; then
## k1
if [ x"$GUPPY_THEME" == x"zbolt" ]; then
tar czf guppyscreen-zbolt.tar.gz -C releases .
echo -n "GUPPY_ARCHIVE_NAME=guppyscreen-zbolt"
else
tar czf guppyscreen.tar.gz -C releases .
echo -n "GUPPY_ARCHIVE_NAME=guppyscreen"
fi
else
if [ x"$GUPPY_THEME" == x"zbolt" ]; then
tar czf guppyscreen-zbolt-arm.tar.gz -C releases .
echo -n "GUPPY_ARCHIVE_NAME=guppyscreen-zbolt-arm"
else
tar czf guppyscreen-arm.tar.gz -C releases .
echo -n "GUPPY_ARCHIVE_NAME=guppyscreen-arm"
fi
fi
1 change: 0 additions & 1 deletion src/console_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ ConsolePanel::ConsolePanel(KWebSocketClient &websocket_client, std::mutex &lock,
, input(lv_textarea_create(input_cont))
, kb(lv_keyboard_create(console_cont))
{
lv_obj_set_style_radius(console_cont, 0, 0);
lv_obj_align(console_cont, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_size(console_cont, LV_PCT(100), LV_PCT(100));
lv_obj_set_flex_flow(console_cont, LV_FLEX_FLOW_COLUMN);
Expand Down
56 changes: 30 additions & 26 deletions src/file_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <sstream>
#include <vector>

FilePanel::FilePanel(lv_obj_t *parent, json &j, const std::string &gcode_path)
FilePanel::FilePanel(lv_obj_t *parent)
: file_cont(lv_obj_create(parent))
, thumbnail(lv_img_create(file_cont))
, detail_label(lv_label_create(file_cont))
Expand All @@ -18,46 +18,50 @@ FilePanel::FilePanel(lv_obj_t *parent, json &j, const std::string &gcode_path)
lv_obj_clear_flag(file_cont, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_align(file_cont, LV_ALIGN_CENTER, 0, 0);

std::time_t timestamp = j["result"]["modified"].template get<std::time_t>();
std::tm lt = *std::localtime(&timestamp);
std::stringstream time_stream;
time_stream << std::put_time(&lt, "%Y-%m-%d %H:%M");
static lv_coord_t grid_main_row_dsc[] = {LV_GRID_FR(3), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};

lv_obj_set_grid_dsc_array(file_cont, grid_main_col_dsc, grid_main_row_dsc);

lv_obj_set_grid_cell(thumbnail, LV_GRID_ALIGN_CENTER, 0, 1, LV_GRID_ALIGN_CENTER, 0, 1);
lv_obj_set_grid_cell(detail_label, LV_GRID_ALIGN_CENTER, 0, 1, LV_GRID_ALIGN_START, 1, 1);
}

FilePanel::~FilePanel() {
if (file_cont != NULL) {
lv_obj_del(file_cont);
file_cont = NULL;
}
}

auto v = j["/result/estimated_time"_json_pointer];
void FilePanel::refresh_view(json &j, const std::string &gcode_path) {
auto v = j["/result/modified"_json_pointer];
std::stringstream time_stream;
if (!v.is_null()) {
std::time_t timestamp = v.template get<std::time_t>();
std::tm lt = *std::localtime(&timestamp);
time_stream << std::put_time(&lt, "%Y-%m-%d %H:%M");
} else {
time_stream << "(unknown)";
}

v = j["/result/estimated_time"_json_pointer];
int eta = v.is_null() ? -1 : v.template get<int>();
v = j["/result/filament_weight_total"_json_pointer];
int fweight = v.is_null() ? -1 : v.template get<int>();

std::string detail = fmt::format("Filament Weight: {} g\nPrint Time: {}\nSize: {} MB\nModified: {}",
fweight > 0 ? std::to_string(fweight) : "(unknown)",
eta > 0 ? KUtils::eta_string(eta) : "(unknown)",
KUtils::bytes_to_mb(j["result"]["size"].template get<size_t>()),
time_stream.str());

// std::string detail = "Modified: " + time_stream.str() + "\n" +
// "Size: " + std::to_string(j["result"]["size"].template get<size_t>()) + " Bytes";

std::string fullpath = KUtils::get_thumbnail(gcode_path, j);
lv_label_set_text(detail_label, detail.c_str());

if (fullpath.length() > 0) {
lv_img_set_src(thumbnail, ("A:" + fullpath).c_str());
lv_img_set_zoom(thumbnail, 150);
}

static lv_coord_t grid_main_row_dsc[] = {LV_GRID_FR(3), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};

lv_obj_set_grid_dsc_array(file_cont, grid_main_col_dsc, grid_main_row_dsc);

lv_obj_set_grid_cell(thumbnail, LV_GRID_ALIGN_CENTER, 0, 1, LV_GRID_ALIGN_CENTER, 0, 1);
lv_obj_set_grid_cell(detail_label, LV_GRID_ALIGN_CENTER, 0, 1, LV_GRID_ALIGN_START, 1, 1);
}

FilePanel::~FilePanel() {
if (file_cont != NULL) {
lv_obj_del(file_cont);
file_cont = NULL;
lv_img_set_zoom(thumbnail, 200);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/file_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ using json = nlohmann::json;

class FilePanel {
public:
FilePanel(lv_obj_t *parent, json &j, const std::string &gcode_path);
FilePanel(lv_obj_t *parent);
~FilePanel();

void foreground();
void refresh_view(json &j, const std::string &gcode_path);
lv_obj_t *get_container();
const char* get_thumbnail_path();

Expand Down
1 change: 1 addition & 0 deletions src/image_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ImageLabel::ImageLabel(lv_obj_t *parent,
lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_size(cont, LV_PCT(width_pct), LV_PCT(height_pct));
lv_obj_set_style_border_width(cont, 2, 0);
lv_obj_set_style_radius(cont, 4, 0);

lv_img_set_src(image, img);
lv_label_set_text(label, value);
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ int main(void)

lv_style_init(&style_container);
lv_style_set_border_width(&style_container, 0);
lv_style_set_radius(&style_container, 0);

lv_style_init(&style_imgbtn_pressed);
lv_style_set_img_recolor_opa(&style_imgbtn_pressed, LV_OPA_100);
Expand Down
6 changes: 1 addition & 5 deletions src/main_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ MainPanel::MainPanel(KWebSocketClient &websocket,
lv_style_set_border_width(&style, 0);
lv_style_set_bg_color(&style, lv_palette_darken(LV_PALETTE_GREY, 4));

lv_obj_set_style_radius(main_cont, 0, 0);

ws.register_notify_update(this);
}

Expand All @@ -72,6 +70,7 @@ MainPanel::~MainPanel() {
void MainPanel::subscribe() {
spdlog::trace("main panel subscribing");
ws.send_jsonrpc("printer.gcode.help", [this](json &d) { console_panel.handle_macros(d); });
print_panel.subscribe();
}

PrinterTunePanel& MainPanel::get_tune_panel() {
Expand Down Expand Up @@ -175,7 +174,6 @@ void MainPanel::handle_ledpanel_cb(lv_event_t *event) {
void MainPanel::handle_print_cb(lv_event_t *event) {
if (lv_event_get_code(event) == LV_EVENT_CLICKED) {
spdlog::trace("clicked print");
print_panel.subscribe();
print_panel.foreground();
}
}
Expand Down Expand Up @@ -217,8 +215,6 @@ void MainPanel::create_main(lv_obj_t * parent)

lv_chart_set_div_line_count(temp_chart, 3, 8);
lv_chart_set_point_count(temp_chart, 250);

lv_obj_set_style_radius(temp_chart, 0, 0);
}

void MainPanel::create_sensors(json &temp_sensors) {
Expand Down
Loading

0 comments on commit 689aba4

Please sign in to comment.