Skip to content

Commit

Permalink
bb3 specific code moved to src/bb3 folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 23, 2021
1 parent 1c29162 commit 8e122a8
Show file tree
Hide file tree
Showing 300 changed files with 10,392 additions and 11,001 deletions.
266 changes: 156 additions & 110 deletions CMakeLists.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modular-psu-firmware.eez-project
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"template": "//${eez-studio SCPI_COMMANDS_DECL}\n"
}
],
"destinationFolder": "src\\eez"
"destinationFolder": "src\\bb3"
}
},
"variables": {
Expand Down
12 changes: 6 additions & 6 deletions src/bb3/action_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#include <stdio.h>
#include <ctype.h> // tolower

#include <eez/firmware.h>
#include <eez/system.h>
#include <eez/tasks.h>
#include <bb3/firmware.h>
#include <bb3/system.h>
#include <bb3/tasks.h>
#include <eez/sound.h>
#include <bb3/index.h>
#include <bb3/mqtt.h>
#include <eez/hmi.h>
#include <bb3/hmi.h>
#include <bb3/usb.h>

#include <bb3/fs_driver.h>
Expand Down Expand Up @@ -63,7 +63,7 @@
#include <bb3/bp3c/io_exp.h>

#if defined(EEZ_PLATFORM_SIMULATOR)
#include <eez/platform/simulator/front_panel.h>
#include <bb3/platform/simulator/front_panel.h>
#endif

using namespace eez::gui;
Expand Down Expand Up @@ -1075,7 +1075,7 @@ void themesEnumDefinition(DataOperationEnum operation, const WidgetCursor &widge
void onSetSelectedThemeIndex(uint16_t value) {
popPage();
persist_conf::setSelectedThemeIndex((uint8_t)value);
mcu::display::onThemeChanged();
display::onThemeChanged();
refreshScreen();
}

Expand Down
118 changes: 118 additions & 0 deletions src/bb3/assets.cpp
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
2 changes: 1 addition & 1 deletion src/bb3/aux_ps/fan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include <bb3/dib-dcp405/dib-dcp405.h>

#include <eez/system.h>
#include <bb3/system.h>

#if defined(EEZ_PLATFORM_STM32)
#include <i2c.h>
Expand Down
2 changes: 1 addition & 1 deletion src/bb3/aux_ps/fan.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <stdint.h>

#include <eez/firmware.h>
#include <bb3/firmware.h>

#define FAN_MODE_AUTO 0
#define FAN_MODE_MANUAL 1
Expand Down
2 changes: 1 addition & 1 deletion src/bb3/aux_ps/pid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <bb3/psu/psu.h>

#include <bb3/aux_ps/pid.h>
#include <eez/system.h>
#include <bb3/system.h>

/*Constructor (...)*********************************************************
* The parameters specified here are those for for which we can't set up
Expand Down
6 changes: 3 additions & 3 deletions src/bb3/bp3c/comm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
#if defined(EEZ_PLATFORM_STM32)
#include <main.h>
#include <crc.h>
#include <eez/platform/stm32/spi.h>
#include <bb3/platform/stm32/spi.h>
#include <stdlib.h>
#endif

#include <eez/debug.h>
#include <bb3/index.h>
#include <eez/system.h>
#include <eez/tasks.h>
#include <bb3/system.h>
#include <bb3/tasks.h>

#include <bb3/bp3c/comm.h>

Expand Down
2 changes: 1 addition & 1 deletion src/bb3/bp3c/eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <stdio.h>
#endif

#include <eez/system.h>
#include <bb3/system.h>
#include <bb3/index.h>
#include <bb3/psu/psu.h>
#include <bb3/psu/persist_conf.h>
Expand Down
8 changes: 4 additions & 4 deletions src/bb3/bp3c/flash_slave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include <assert.h>

#include <eez/firmware.h>
#include <eez/system.h>
#include <bb3/firmware.h>
#include <bb3/system.h>
#include <bb3/uart.h>

#include <bb3/psu/psu.h>
Expand All @@ -35,14 +35,14 @@
#include <bb3/bp3c/io_exp.h>
#include <bb3/bp3c/eeprom.h>

#include <eez/libs/sd_fat/sd_fat.h>
#include <bb3/fs/fs.h>

#ifdef EEZ_PLATFORM_STM32

#include <memory.h>
#include "main.h"
#include "usart.h"
#include <eez/platform/stm32/spi.h>
#include <bb3/platform/stm32/spi.h>

#endif

Expand Down
2 changes: 1 addition & 1 deletion src/bb3/bp3c/io_exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <cmsis_os.h>
#endif

#include <eez/system.h>
#include <bb3/system.h>

// TODO
#include <bb3/psu/psu.h> // TestResult
Expand Down
102 changes: 102 additions & 0 deletions src/bb3/conf/eez/conf.h
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
37 changes: 37 additions & 0 deletions src/bb3/conf/eez/gui_conf.h
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
Loading

0 comments on commit 8e122a8

Please sign in to comment.