Skip to content

Commit 8e122a8

Browse files
committed
bb3 specific code moved to src/bb3 folder
1 parent 1c29162 commit 8e122a8

File tree

300 files changed

+10392
-11001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+10392
-11001
lines changed

CMakeLists.txt

+156-110
Large diffs are not rendered by default.

modular-psu-firmware.eez-project

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"template": "//${eez-studio SCPI_COMMANDS_DECL}\n"
6262
}
6363
],
64-
"destinationFolder": "src\\eez"
64+
"destinationFolder": "src\\bb3"
6565
}
6666
},
6767
"variables": {

src/bb3/action_impl.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
#include <stdio.h>
2222
#include <ctype.h> // tolower
2323

24-
#include <eez/firmware.h>
25-
#include <eez/system.h>
26-
#include <eez/tasks.h>
24+
#include <bb3/firmware.h>
25+
#include <bb3/system.h>
26+
#include <bb3/tasks.h>
2727
#include <eez/sound.h>
2828
#include <bb3/index.h>
2929
#include <bb3/mqtt.h>
30-
#include <eez/hmi.h>
30+
#include <bb3/hmi.h>
3131
#include <bb3/usb.h>
3232

3333
#include <bb3/fs_driver.h>
@@ -63,7 +63,7 @@
6363
#include <bb3/bp3c/io_exp.h>
6464

6565
#if defined(EEZ_PLATFORM_SIMULATOR)
66-
#include <eez/platform/simulator/front_panel.h>
66+
#include <bb3/platform/simulator/front_panel.h>
6767
#endif
6868

6969
using namespace eez::gui;
@@ -1075,7 +1075,7 @@ void themesEnumDefinition(DataOperationEnum operation, const WidgetCursor &widge
10751075
void onSetSelectedThemeIndex(uint16_t value) {
10761076
popPage();
10771077
persist_conf::setSelectedThemeIndex((uint8_t)value);
1078-
mcu::display::onThemeChanged();
1078+
display::onThemeChanged();
10791079
refreshScreen();
10801080
}
10811081

src/bb3/assets.cpp

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
* EEZ Modular Firmware
3+
* Copyright (C) 2015-present, Envox d.o.o.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#include <eez/gui/gui.h>
20+
21+
#include <bb3/fs/fs.h>
22+
23+
#include <scpi/scpi.h>
24+
25+
namespace eez {
26+
namespace gui {
27+
28+
bool loadExternalAssets(const char *filePath, int *err) {
29+
unloadExternalAssets();
30+
31+
eez::File file;
32+
if (!file.open(filePath, FILE_OPEN_EXISTING | FILE_READ)) {
33+
if (err) {
34+
*err = SCPI_ERROR_FILE_NAME_NOT_FOUND;
35+
}
36+
return false;
37+
}
38+
39+
uint32_t fileSize = file.size();
40+
41+
if (fileSize == 0) {
42+
if (err) {
43+
*err = SCPI_ERROR_MASS_STORAGE_ERROR;
44+
}
45+
return false;
46+
}
47+
48+
uint8_t *fileData = (uint8_t *)alloc(((fileSize + 3) / 4) * 4, 202);
49+
if (!fileData) {
50+
if (err) {
51+
*err = SCPI_ERROR_OUT_OF_DEVICE_MEMORY;
52+
}
53+
return false;
54+
}
55+
56+
uint32_t bytesRead = file.read(fileData, fileSize);
57+
file.close();
58+
59+
if (bytesRead != fileSize) {
60+
free(fileData);
61+
if (err) {
62+
*err = SCPI_ERROR_MASS_STORAGE_ERROR;
63+
}
64+
return false;
65+
}
66+
67+
auto header = (Header *)fileData;
68+
69+
if (header->tag != HEADER_TAG) {
70+
free(fileData);
71+
if (err) {
72+
*err = SCPI_ERROR_INVALID_BLOCK_DATA;
73+
}
74+
return false;
75+
}
76+
77+
// disable warning: offsetof within non-standard-layout type ... is conditionally-supported [-Winvalid-offsetof]
78+
#ifdef __GNUC__
79+
#pragma GCC diagnostic push
80+
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
81+
#endif
82+
83+
auto decompressedDataOffset = offsetof(Assets, pages);
84+
85+
#ifdef __GNUC__
86+
#pragma GCC diagnostic pop
87+
#endif
88+
89+
size_t externalAssetsSize = decompressedDataOffset + header->decompressedSize;
90+
g_externalAssets = (Assets *)alloc(externalAssetsSize, 301);
91+
if (!g_externalAssets) {
92+
free(g_externalAssets);
93+
g_externalAssets = nullptr;
94+
95+
if (err) {
96+
*err = SCPI_ERROR_OUT_OF_DEVICE_MEMORY;
97+
}
98+
99+
return false;
100+
}
101+
102+
g_externalAssets->external = true;
103+
104+
auto result = decompressAssetsData(fileData, fileSize, g_externalAssets, externalAssetsSize, err);
105+
106+
free(fileData);
107+
108+
if (!result) {
109+
free(g_externalAssets);
110+
g_externalAssets = nullptr;
111+
return false;
112+
}
113+
114+
return true;
115+
}
116+
117+
} // namespace gui
118+
} // namespace eez

src/bb3/aux_ps/fan.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

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

32-
#include <eez/system.h>
32+
#include <bb3/system.h>
3333

3434
#if defined(EEZ_PLATFORM_STM32)
3535
#include <i2c.h>

src/bb3/aux_ps/fan.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <stdint.h>
2222

23-
#include <eez/firmware.h>
23+
#include <bb3/firmware.h>
2424

2525
#define FAN_MODE_AUTO 0
2626
#define FAN_MODE_MANUAL 1

src/bb3/aux_ps/pid.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <bb3/psu/psu.h>
99

1010
#include <bb3/aux_ps/pid.h>
11-
#include <eez/system.h>
11+
#include <bb3/system.h>
1212

1313
/*Constructor (...)*********************************************************
1414
* The parameters specified here are those for for which we can't set up

src/bb3/bp3c/comm.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
#if defined(EEZ_PLATFORM_STM32)
2222
#include <main.h>
2323
#include <crc.h>
24-
#include <eez/platform/stm32/spi.h>
24+
#include <bb3/platform/stm32/spi.h>
2525
#include <stdlib.h>
2626
#endif
2727

2828
#include <eez/debug.h>
2929
#include <bb3/index.h>
30-
#include <eez/system.h>
31-
#include <eez/tasks.h>
30+
#include <bb3/system.h>
31+
#include <bb3/tasks.h>
3232

3333
#include <bb3/bp3c/comm.h>
3434

src/bb3/bp3c/eeprom.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <stdio.h>
2727
#endif
2828

29-
#include <eez/system.h>
29+
#include <bb3/system.h>
3030
#include <bb3/index.h>
3131
#include <bb3/psu/psu.h>
3232
#include <bb3/psu/persist_conf.h>

src/bb3/bp3c/flash_slave.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#include <assert.h>
2020

21-
#include <eez/firmware.h>
22-
#include <eez/system.h>
21+
#include <bb3/firmware.h>
22+
#include <bb3/system.h>
2323
#include <bb3/uart.h>
2424

2525
#include <bb3/psu/psu.h>
@@ -35,14 +35,14 @@
3535
#include <bb3/bp3c/io_exp.h>
3636
#include <bb3/bp3c/eeprom.h>
3737

38-
#include <eez/libs/sd_fat/sd_fat.h>
38+
#include <bb3/fs/fs.h>
3939

4040
#ifdef EEZ_PLATFORM_STM32
4141

4242
#include <memory.h>
4343
#include "main.h"
4444
#include "usart.h"
45-
#include <eez/platform/stm32/spi.h>
45+
#include <bb3/platform/stm32/spi.h>
4646

4747
#endif
4848

src/bb3/bp3c/io_exp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <cmsis_os.h>
2222
#endif
2323

24-
#include <eez/system.h>
24+
#include <bb3/system.h>
2525

2626
// TODO
2727
#include <bb3/psu/psu.h> // TestResult

src/bb3/conf/eez/conf.h

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* EEZ Modular Firmware
3+
* Copyright (C) 2021-present, Envox d.o.o.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#pragma once
20+
21+
#define MAX_NUM_OF_Y_AXES 18
22+
#define MAX_NUM_OF_Y_VALUES MAX_NUM_OF_Y_AXES
23+
24+
#define OPTION_KEYBOARD 1
25+
#define OPTION_MOUSE 1
26+
27+
#define CUSTOM_VALUE_TYPES \
28+
VALUE_TYPE(PASSWORD) \
29+
VALUE_TYPE(PERCENTAGE) \
30+
VALUE_TYPE(SIZE) \
31+
VALUE_TYPE(TIME_SECONDS) \
32+
VALUE_TYPE(LESS_THEN_MIN_FLOAT) \
33+
VALUE_TYPE(GREATER_THEN_MAX_FLOAT) \
34+
VALUE_TYPE(CHANNEL_LABEL) \
35+
VALUE_TYPE(CHANNEL_SHORT_LABEL) \
36+
VALUE_TYPE(CHANNEL_SHORT_LABEL_WITHOUT_COLUMN) \
37+
VALUE_TYPE(CHANNEL_BOARD_INFO_LABEL) \
38+
VALUE_TYPE(LESS_THEN_MIN_INT) \
39+
VALUE_TYPE(LESS_THEN_MIN_TIME_ZONE) \
40+
VALUE_TYPE(GREATER_THEN_MAX_INT) \
41+
VALUE_TYPE(GREATER_THEN_MAX_TIME_ZONE) \
42+
VALUE_TYPE(EVENT) \
43+
VALUE_TYPE(EVENT_MESSAGE) \
44+
VALUE_TYPE(ON_TIME_COUNTER) \
45+
VALUE_TYPE(COUNTDOWN) \
46+
VALUE_TYPE(TIME_ZONE) \
47+
VALUE_TYPE(DATE_DMY) \
48+
VALUE_TYPE(DATE_MDY) \
49+
VALUE_TYPE(YEAR) \
50+
VALUE_TYPE(MONTH) \
51+
VALUE_TYPE(DAY) \
52+
VALUE_TYPE(TIME) \
53+
VALUE_TYPE(TIME12) \
54+
VALUE_TYPE(HOUR) \
55+
VALUE_TYPE(MINUTE) \
56+
VALUE_TYPE(SECOND) \
57+
VALUE_TYPE(USER_PROFILE_LABEL) \
58+
VALUE_TYPE(USER_PROFILE_REMARK) \
59+
VALUE_TYPE(EDIT_INFO) \
60+
VALUE_TYPE(MAC_ADDRESS) \
61+
VALUE_TYPE(IP_ADDRESS) \
62+
VALUE_TYPE(PORT) \
63+
VALUE_TYPE(TEXT_MESSAGE) \
64+
VALUE_TYPE(STEP_VALUES) \
65+
VALUE_TYPE(FLOAT_LIST) \
66+
VALUE_TYPE(CHANNEL_TITLE) \
67+
VALUE_TYPE(CHANNEL_SHORT_TITLE) \
68+
VALUE_TYPE(CHANNEL_SHORT_TITLE_WITHOUT_TRACKING_ICON) \
69+
VALUE_TYPE(CHANNEL_LONG_TITLE) \
70+
VALUE_TYPE(CHANNEL_ID) \
71+
VALUE_TYPE(DLOG_VALUE_LABEL) \
72+
VALUE_TYPE(DLOG_CURRENT_TIME) \
73+
VALUE_TYPE(FILE_LENGTH) \
74+
VALUE_TYPE(FILE_DATE_TIME) \
75+
VALUE_TYPE(FIRMWARE_VERSION) \
76+
VALUE_TYPE(SLOT_INDEX) \
77+
VALUE_TYPE(SLOT_INFO) \
78+
VALUE_TYPE(SLOT_INFO_WITH_FW_VER) \
79+
VALUE_TYPE(SLOT_TITLE) \
80+
VALUE_TYPE(SLOT_TITLE_DEF) \
81+
VALUE_TYPE(SLOT_TITLE_MAX) \
82+
VALUE_TYPE(SLOT_TITLE_SETTINGS) \
83+
VALUE_TYPE(SLOT_SHORT_TITLE) \
84+
VALUE_TYPE(MASTER_INFO) \
85+
VALUE_TYPE(MASTER_INFO_WITH_FW_VER) \
86+
VALUE_TYPE(TEST_RESULT) \
87+
VALUE_TYPE(SCPI_ERROR) \
88+
VALUE_TYPE(STORAGE_INFO) \
89+
VALUE_TYPE(FOLDER_INFO) \
90+
VALUE_TYPE(MODULE_SERIAL_INFO) \
91+
VALUE_TYPE(CALIBRATION_VALUE_TYPE_INFO) \
92+
VALUE_TYPE(CALIBRATION_POINT_INFO) \
93+
VALUE_TYPE(ZOOM) \
94+
VALUE_TYPE(NUM_SELECTED) \
95+
VALUE_TYPE(CURRENT_DIRECTORY_TITLE) \
96+
VALUE_TYPE(MASS_STORAGE_DEVICE_LABEL) \
97+
VALUE_TYPE(OCP_TRIP_LEVEL_INFO) \
98+
VALUE_TYPE(AUTO_START_SCRIPT_CONFIRMATION_MESSAGE) \
99+
100+
#define DISPLAY_BACKGROUND_LUMINOSITY_STEP_MIN 0
101+
#define DISPLAY_BACKGROUND_LUMINOSITY_STEP_MAX 20
102+
#define DISPLAY_BACKGROUND_LUMINOSITY_STEP_DEFAULT 10

src/bb3/conf/eez/gui_conf.h

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* EEZ Modular Firmware
3+
* Copyright (C) 2021-present, Envox d.o.o.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
#pragma once
20+
21+
#include <bb3/gui/document.h>
22+
23+
#define EEZ_CONF_PAGE_ID_ASYNC_OPERATION_IN_PROGRESS eez::gui::PAGE_ID_ASYNC_OPERATION_IN_PROGRESS
24+
#define EEZ_CONF_PAGE_ID_WELCOME eez::gui::PAGE_ID_WELCOME
25+
26+
#define EEZ_CONF_DATA_ID_EDIT_UNIT eez::gui::DATA_ID_EDIT_UNIT
27+
28+
#define EEZ_CONF_ACTION_ID_EDIT eez::gui::ACTION_ID_EDIT
29+
#define EEZ_CONF_ACTION_ID_DRAG_OVERLAY eez::gui::ACTION_ID_DRAG_OVERLAY
30+
#define EEZ_CONF_ACTION_ID_SCROLL eez::gui::ACTION_ID_SCROLL
31+
32+
#define EEZ_CONF_STYLE_ID_DEFAULT eez::gui::STYLE_ID_DEFAULT
33+
34+
#define EEZ_CONF_FONT_ID_SHADOW eez::gui::FONT_ID_SHADOW
35+
36+
#define EEZ_CONF_COLOR_ID_BOOKMARK eez::gui::COLOR_ID_BOOKMARK
37+
#define EEZ_CONF_COLOR_ID_BACKDROP eez::gui::COLOR_ID_BACKDROP

0 commit comments

Comments
 (0)