starting with search_screen

- optimized partitions
This commit is contained in:
2023-08-11 22:58:38 +02:00
parent ee54b0ed0b
commit 4cfaa910d1
16 changed files with 397 additions and 21 deletions

View File

@@ -0,0 +1,59 @@
//----------------------------------------------------------------------------
// OS-Railway - Remote Control
// Copyright (C) 2023 Peter Siegmund (https://mars3142.dev)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//----------------------------------------------------------------------------
#include "launch_screen.h"
#include "lv_i18n/lv_i18n.h"
#include "search_screen.h"
void LaunchScreen::init()
{
screen = lv_obj_create(NULL);
lv_obj_clear_flag(screen, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_style_bg_color(screen, lv_color_make(0x78, 0x94, 0xa7), 0);
LV_IMG_DECLARE(os_railway_icon_lvgl);
auto *logo = lv_img_create(screen);
lv_img_set_src(logo, &os_railway_icon_lvgl);
lv_obj_align(logo, LV_ALIGN_CENTER, 0, 0);
auto *label = lv_label_create(screen);
lv_label_set_text(label, _("appName"));
lv_obj_align(label, LV_ALIGN_BOTTOM_MID, 0, -25);
{
lv_disp_load_scr(screen);
timer();
}
}
void LaunchScreen::dispose()
{
lv_obj_del(screen);
screen = nullptr;
}
void my_timer(lv_timer_t *timer)
{
lv_timer_del(timer);
SearchScreen().show();
}
void LaunchScreen::timer()
{
lv_timer_t *timer = lv_timer_create(my_timer, 2000, NULL);
}

View File

@@ -0,0 +1,32 @@
//----------------------------------------------------------------------------
// OS-Railway - Remote Control
// Copyright (C) 2023 Peter Siegmund (https://mars3142.dev)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//----------------------------------------------------------------------------
#pragma once
#include <lvgl.h>
class LaunchScreen
{
private:
lv_obj_t *screen;
void timer();
public:
void init();
void dispose();
};

View File

@@ -0,0 +1,41 @@
//----------------------------------------------------------------------------
// OS-Railway - Remote Control
// Copyright (C) 2023 Peter Siegmund (https://mars3142.dev)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//----------------------------------------------------------------------------
#include "provisioning_screen.h"
ProvisioningScreen::ProvisioningScreen()
{
screen = lv_obj_create(NULL);
lv_color_t bg_color = lv_palette_lighten(LV_PALETTE_LIGHT_BLUE, 5);
lv_color_t fg_color = lv_palette_darken(LV_PALETTE_BLUE, 4);
lv_obj_t *qr = lv_qrcode_create(screen, 150, fg_color, bg_color);
const char *data = "{\"ver\":\"v2\",\"name\":\"OSRW_RC\",\"pop\":\"a1000318\",\"transport\":\"ble\"}";
lv_qrcode_update(qr, data, strlen(data));
lv_obj_center(qr);
lv_obj_set_style_border_color(qr, bg_color, 0);
lv_obj_set_style_border_width(qr, 5, 0);
}
void ProvisioningScreen::show()
{
lv_disp_load_scr(screen);
}

View File

@@ -0,0 +1,31 @@
//----------------------------------------------------------------------------
// OS-Railway - Remote Control
// Copyright (C) 2023 Peter Siegmund (https://mars3142.dev)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//----------------------------------------------------------------------------
#pragma once
#include <lvgl.h>
class ProvisioningScreen
{
private:
lv_obj_t *screen;
public:
ProvisioningScreen();
void show();
};

View File

@@ -0,0 +1,34 @@
//----------------------------------------------------------------------------
// OS-Railway - Remote Control
// Copyright (C) 2023 Peter Siegmund (https://mars3142.dev)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//----------------------------------------------------------------------------
#include "search_screen.h"
#include "../widgets/status_bar_widget.h"
SearchScreen::SearchScreen()
{
screen = lv_obj_create(NULL);
lv_obj_clear_flag(screen, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_style_bg_color(screen, lv_color_make(0x78, 0x94, 0xa7), 0);
}
void SearchScreen::show()
{
status_bar_widget_init();
lv_disp_load_scr(this->screen);
}

View File

@@ -0,0 +1,31 @@
//----------------------------------------------------------------------------
// OS-Railway - Remote Control
// Copyright (C) 2023 Peter Siegmund (https://mars3142.dev)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//----------------------------------------------------------------------------
#pragma once
#include <lvgl.h>
class SearchScreen
{
private:
lv_obj_t *screen;
public:
SearchScreen();
void show();
};