-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bb3 specific code moved to src/bb3 folder
- Loading branch information
Showing
300 changed files
with
10,392 additions
and
11,001 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* EEZ Modular Firmware | ||
* Copyright (C) 2015-present, Envox d.o.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU 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 General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <eez/gui/gui.h> | ||
|
||
#include <bb3/fs/fs.h> | ||
|
||
#include <scpi/scpi.h> | ||
|
||
namespace eez { | ||
namespace gui { | ||
|
||
bool loadExternalAssets(const char *filePath, int *err) { | ||
unloadExternalAssets(); | ||
|
||
eez::File file; | ||
if (!file.open(filePath, FILE_OPEN_EXISTING | FILE_READ)) { | ||
if (err) { | ||
*err = SCPI_ERROR_FILE_NAME_NOT_FOUND; | ||
} | ||
return false; | ||
} | ||
|
||
uint32_t fileSize = file.size(); | ||
|
||
if (fileSize == 0) { | ||
if (err) { | ||
*err = SCPI_ERROR_MASS_STORAGE_ERROR; | ||
} | ||
return false; | ||
} | ||
|
||
uint8_t *fileData = (uint8_t *)alloc(((fileSize + 3) / 4) * 4, 202); | ||
if (!fileData) { | ||
if (err) { | ||
*err = SCPI_ERROR_OUT_OF_DEVICE_MEMORY; | ||
} | ||
return false; | ||
} | ||
|
||
uint32_t bytesRead = file.read(fileData, fileSize); | ||
file.close(); | ||
|
||
if (bytesRead != fileSize) { | ||
free(fileData); | ||
if (err) { | ||
*err = SCPI_ERROR_MASS_STORAGE_ERROR; | ||
} | ||
return false; | ||
} | ||
|
||
auto header = (Header *)fileData; | ||
|
||
if (header->tag != HEADER_TAG) { | ||
free(fileData); | ||
if (err) { | ||
*err = SCPI_ERROR_INVALID_BLOCK_DATA; | ||
} | ||
return false; | ||
} | ||
|
||
// disable warning: offsetof within non-standard-layout type ... is conditionally-supported [-Winvalid-offsetof] | ||
#ifdef __GNUC__ | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Winvalid-offsetof" | ||
#endif | ||
|
||
auto decompressedDataOffset = offsetof(Assets, pages); | ||
|
||
#ifdef __GNUC__ | ||
#pragma GCC diagnostic pop | ||
#endif | ||
|
||
size_t externalAssetsSize = decompressedDataOffset + header->decompressedSize; | ||
g_externalAssets = (Assets *)alloc(externalAssetsSize, 301); | ||
if (!g_externalAssets) { | ||
free(g_externalAssets); | ||
g_externalAssets = nullptr; | ||
|
||
if (err) { | ||
*err = SCPI_ERROR_OUT_OF_DEVICE_MEMORY; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
g_externalAssets->external = true; | ||
|
||
auto result = decompressAssetsData(fileData, fileSize, g_externalAssets, externalAssetsSize, err); | ||
|
||
free(fileData); | ||
|
||
if (!result) { | ||
free(g_externalAssets); | ||
g_externalAssets = nullptr; | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} // namespace gui | ||
} // namespace eez |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* EEZ Modular Firmware | ||
* Copyright (C) 2021-present, Envox d.o.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU 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 General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#define MAX_NUM_OF_Y_AXES 18 | ||
#define MAX_NUM_OF_Y_VALUES MAX_NUM_OF_Y_AXES | ||
|
||
#define OPTION_KEYBOARD 1 | ||
#define OPTION_MOUSE 1 | ||
|
||
#define CUSTOM_VALUE_TYPES \ | ||
VALUE_TYPE(PASSWORD) \ | ||
VALUE_TYPE(PERCENTAGE) \ | ||
VALUE_TYPE(SIZE) \ | ||
VALUE_TYPE(TIME_SECONDS) \ | ||
VALUE_TYPE(LESS_THEN_MIN_FLOAT) \ | ||
VALUE_TYPE(GREATER_THEN_MAX_FLOAT) \ | ||
VALUE_TYPE(CHANNEL_LABEL) \ | ||
VALUE_TYPE(CHANNEL_SHORT_LABEL) \ | ||
VALUE_TYPE(CHANNEL_SHORT_LABEL_WITHOUT_COLUMN) \ | ||
VALUE_TYPE(CHANNEL_BOARD_INFO_LABEL) \ | ||
VALUE_TYPE(LESS_THEN_MIN_INT) \ | ||
VALUE_TYPE(LESS_THEN_MIN_TIME_ZONE) \ | ||
VALUE_TYPE(GREATER_THEN_MAX_INT) \ | ||
VALUE_TYPE(GREATER_THEN_MAX_TIME_ZONE) \ | ||
VALUE_TYPE(EVENT) \ | ||
VALUE_TYPE(EVENT_MESSAGE) \ | ||
VALUE_TYPE(ON_TIME_COUNTER) \ | ||
VALUE_TYPE(COUNTDOWN) \ | ||
VALUE_TYPE(TIME_ZONE) \ | ||
VALUE_TYPE(DATE_DMY) \ | ||
VALUE_TYPE(DATE_MDY) \ | ||
VALUE_TYPE(YEAR) \ | ||
VALUE_TYPE(MONTH) \ | ||
VALUE_TYPE(DAY) \ | ||
VALUE_TYPE(TIME) \ | ||
VALUE_TYPE(TIME12) \ | ||
VALUE_TYPE(HOUR) \ | ||
VALUE_TYPE(MINUTE) \ | ||
VALUE_TYPE(SECOND) \ | ||
VALUE_TYPE(USER_PROFILE_LABEL) \ | ||
VALUE_TYPE(USER_PROFILE_REMARK) \ | ||
VALUE_TYPE(EDIT_INFO) \ | ||
VALUE_TYPE(MAC_ADDRESS) \ | ||
VALUE_TYPE(IP_ADDRESS) \ | ||
VALUE_TYPE(PORT) \ | ||
VALUE_TYPE(TEXT_MESSAGE) \ | ||
VALUE_TYPE(STEP_VALUES) \ | ||
VALUE_TYPE(FLOAT_LIST) \ | ||
VALUE_TYPE(CHANNEL_TITLE) \ | ||
VALUE_TYPE(CHANNEL_SHORT_TITLE) \ | ||
VALUE_TYPE(CHANNEL_SHORT_TITLE_WITHOUT_TRACKING_ICON) \ | ||
VALUE_TYPE(CHANNEL_LONG_TITLE) \ | ||
VALUE_TYPE(CHANNEL_ID) \ | ||
VALUE_TYPE(DLOG_VALUE_LABEL) \ | ||
VALUE_TYPE(DLOG_CURRENT_TIME) \ | ||
VALUE_TYPE(FILE_LENGTH) \ | ||
VALUE_TYPE(FILE_DATE_TIME) \ | ||
VALUE_TYPE(FIRMWARE_VERSION) \ | ||
VALUE_TYPE(SLOT_INDEX) \ | ||
VALUE_TYPE(SLOT_INFO) \ | ||
VALUE_TYPE(SLOT_INFO_WITH_FW_VER) \ | ||
VALUE_TYPE(SLOT_TITLE) \ | ||
VALUE_TYPE(SLOT_TITLE_DEF) \ | ||
VALUE_TYPE(SLOT_TITLE_MAX) \ | ||
VALUE_TYPE(SLOT_TITLE_SETTINGS) \ | ||
VALUE_TYPE(SLOT_SHORT_TITLE) \ | ||
VALUE_TYPE(MASTER_INFO) \ | ||
VALUE_TYPE(MASTER_INFO_WITH_FW_VER) \ | ||
VALUE_TYPE(TEST_RESULT) \ | ||
VALUE_TYPE(SCPI_ERROR) \ | ||
VALUE_TYPE(STORAGE_INFO) \ | ||
VALUE_TYPE(FOLDER_INFO) \ | ||
VALUE_TYPE(MODULE_SERIAL_INFO) \ | ||
VALUE_TYPE(CALIBRATION_VALUE_TYPE_INFO) \ | ||
VALUE_TYPE(CALIBRATION_POINT_INFO) \ | ||
VALUE_TYPE(ZOOM) \ | ||
VALUE_TYPE(NUM_SELECTED) \ | ||
VALUE_TYPE(CURRENT_DIRECTORY_TITLE) \ | ||
VALUE_TYPE(MASS_STORAGE_DEVICE_LABEL) \ | ||
VALUE_TYPE(OCP_TRIP_LEVEL_INFO) \ | ||
VALUE_TYPE(AUTO_START_SCRIPT_CONFIRMATION_MESSAGE) \ | ||
|
||
#define DISPLAY_BACKGROUND_LUMINOSITY_STEP_MIN 0 | ||
#define DISPLAY_BACKGROUND_LUMINOSITY_STEP_MAX 20 | ||
#define DISPLAY_BACKGROUND_LUMINOSITY_STEP_DEFAULT 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* EEZ Modular Firmware | ||
* Copyright (C) 2021-present, Envox d.o.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU 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 General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <bb3/gui/document.h> | ||
|
||
#define EEZ_CONF_PAGE_ID_ASYNC_OPERATION_IN_PROGRESS eez::gui::PAGE_ID_ASYNC_OPERATION_IN_PROGRESS | ||
#define EEZ_CONF_PAGE_ID_WELCOME eez::gui::PAGE_ID_WELCOME | ||
|
||
#define EEZ_CONF_DATA_ID_EDIT_UNIT eez::gui::DATA_ID_EDIT_UNIT | ||
|
||
#define EEZ_CONF_ACTION_ID_EDIT eez::gui::ACTION_ID_EDIT | ||
#define EEZ_CONF_ACTION_ID_DRAG_OVERLAY eez::gui::ACTION_ID_DRAG_OVERLAY | ||
#define EEZ_CONF_ACTION_ID_SCROLL eez::gui::ACTION_ID_SCROLL | ||
|
||
#define EEZ_CONF_STYLE_ID_DEFAULT eez::gui::STYLE_ID_DEFAULT | ||
|
||
#define EEZ_CONF_FONT_ID_SHADOW eez::gui::FONT_ID_SHADOW | ||
|
||
#define EEZ_CONF_COLOR_ID_BOOKMARK eez::gui::COLOR_ID_BOOKMARK | ||
#define EEZ_CONF_COLOR_ID_BACKDROP eez::gui::COLOR_ID_BACKDROP |
Oops, something went wrong.