Skip to content

Commit

Permalink
disable wifi panel on android.
Browse files Browse the repository at this point in the history
  • Loading branch information
ballaswag committed Apr 19, 2024
1 parent f0a3700 commit 0b6f3d5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/print_status_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LV_IMG_DECLARE(cancel);
LV_IMG_DECLARE(emergency);
LV_IMG_DECLARE(back);

constexpr double pi() { return std::atan(1)*4; }
double pi() { return std::atan(1)*4; }

PrintStatusPanel::PrintStatusPanel(KWebSocketClient &websocket_client,
std::mutex &lock,
Expand Down
7 changes: 7 additions & 0 deletions src/setting_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ LV_IMG_DECLARE(print);
SettingPanel::SettingPanel(KWebSocketClient &c, std::mutex &l, lv_obj_t *parent, SpoolmanPanel &sm)
: ws(c)
, cont(lv_obj_create(parent))
#ifndef OS_ANDROID
, wifi_panel(l)
#endif
, sysinfo_panel()
, spoolman_panel(sm)
, wifi_btn(cont, &network_img, "WIFI", &SettingPanel::_handle_callback, this)
Expand All @@ -44,6 +46,9 @@ SettingPanel::SettingPanel(KWebSocketClient &c, std::mutex &l, lv_obj_t *parent,
lv_obj_set_size(cont, LV_PCT(100), LV_PCT(100));

spoolman_btn.disable();
#ifdef OS_ANDROID
wifi_btn.disable();
#endif

static lv_coord_t grid_main_row_dsc[] = {LV_GRID_FR(2), LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_TEMPLATE_LAST};
static lv_coord_t grid_main_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_FR(1),
Expand Down Expand Up @@ -82,7 +87,9 @@ void SettingPanel::handle_callback(lv_event_t *event) {

if (btn == wifi_btn.get_container()) {
spdlog::trace("wifi pressed");
#ifndef OS_ANDROID
wifi_panel.foreground();
#endif
} else if (btn == sysinfo_btn.get_container()) {
spdlog::trace("setting system info pressed");
sysinfo_panel.foreground();
Expand Down
9 changes: 9 additions & 0 deletions src/setting_panel.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#ifndef __SETTING_PANEL_H__
#define __SETTING_PANEL_H__

#include "platform.h"

#ifndef OS_ANDROID
#include "wifi_panel.h"
#endif

#include "sysinfo_panel.h"
#include "spoolman_panel.h"
#include "printer_select_panel.h"
Expand Down Expand Up @@ -29,7 +34,11 @@ class SettingPanel {
private:
KWebSocketClient &ws;
lv_obj_t *cont;

#ifndef OS_ANDROID
WifiPanel wifi_panel;
#endif

SysInfoPanel sysinfo_panel;
SpoolmanPanel &spoolman_panel;
PrinterSelectPanel printer_select_panel;
Expand Down
2 changes: 1 addition & 1 deletion src/websocket_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using namespace hv;
using json = nlohmann::json;

KWebSocketClient::KWebSocketClient(EventLoopPtr loop = NULL)
KWebSocketClient::KWebSocketClient(EventLoopPtr loop)
: WebSocketClient(loop)
, id(0)
{
Expand Down

0 comments on commit 0b6f3d5

Please sign in to comment.