Skip to content

Commit 8782700

Browse files
committed
fix emscripten build
1 parent c51fa2b commit 8782700

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

src/eez/function_generator.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ float getMax(WaveformParameters &waveformParameters) {
327327

328328
class FunctionGeneratorPage : public SetPage {
329329
public:
330-
static const int PAGE_SIZE = 4;
330+
static const int FUNC_GEN_PAGE_SIZE = 4;
331331

332332
bool m_initialized = false;
333333

@@ -698,14 +698,14 @@ class FunctionGeneratorPage : public SetPage {
698698
}
699699

700700
void setScrollPosition(int scrollPosition) {
701-
if (g_selectedResources.m_numResources <= PAGE_SIZE) {
701+
if (g_selectedResources.m_numResources <= FUNC_GEN_PAGE_SIZE) {
702702
return;
703703
}
704704

705705
if (scrollPosition < 0) {
706706
scrollPosition = 0;
707-
} else if (scrollPosition > g_selectedResources.m_numResources - PAGE_SIZE) {
708-
scrollPosition = g_selectedResources.m_numResources - PAGE_SIZE;
707+
} else if (scrollPosition > g_selectedResources.m_numResources - FUNC_GEN_PAGE_SIZE) {
708+
scrollPosition = g_selectedResources.m_numResources - FUNC_GEN_PAGE_SIZE;
709709
}
710710

711711
if (scrollPosition != m_scrollPosition) {
@@ -773,7 +773,7 @@ void initWaveformParameters(WaveformParameters &waveformParameters) {
773773

774774
class FunctionGeneratorSelectChannelsPage : public SetPage {
775775
public:
776-
static const int PAGE_SIZE = 7;
776+
static const int FUNC_GEN_PAGE_SIZE = 7;
777777

778778
void pageAlloc() {
779779
AllResources::reset();
@@ -839,14 +839,14 @@ class FunctionGeneratorSelectChannelsPage : public SetPage {
839839
}
840840

841841
void setScrollPosition(int scrollPosition) {
842-
if (AllResources::getNumResources() <= PAGE_SIZE) {
842+
if (AllResources::getNumResources() <= FUNC_GEN_PAGE_SIZE) {
843843
return;
844844
}
845845

846846
if (scrollPosition < 0) {
847847
scrollPosition = 0;
848-
} else if (scrollPosition > AllResources::getNumResources() - PAGE_SIZE) {
849-
scrollPosition = AllResources::getNumResources() - PAGE_SIZE;
848+
} else if (scrollPosition > AllResources::getNumResources() - FUNC_GEN_PAGE_SIZE) {
849+
scrollPosition = AllResources::getNumResources() - FUNC_GEN_PAGE_SIZE;
850850
}
851851

852852
if (scrollPosition != m_scrollPosition) {
@@ -1180,8 +1180,8 @@ void selectWaveformParametersForChannel(int slotIndex, int subchannelIndex, int
11801180
if (tmpSlotIndex == slotIndex && tmpSubchannelIndex == subchannelIndex && (resourceIndex == -1 || tmpResourceIndex == resourceIndex)) {
11811181
g_functionGeneratorPage.m_selectedItem = i;
11821182

1183-
if (i >= FunctionGeneratorPage::PAGE_SIZE) {
1184-
g_functionGeneratorPage.setScrollPosition(i - FunctionGeneratorPage::PAGE_SIZE + 1);
1183+
if (i >= FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE) {
1184+
g_functionGeneratorPage.setScrollPosition(i - FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE + 1);
11851185
}
11861186

11871187
break;
@@ -2118,26 +2118,26 @@ void data_function_generator_channels(DataOperationEnum operation, Cursor cursor
21182118
} else if (operation == DATA_OPERATION_YT_DATA_GET_POSITION_INCREMENT) {
21192119
value = 1;
21202120
} else if (operation == DATA_OPERATION_YT_DATA_GET_PAGE_SIZE) {
2121-
value = FunctionGeneratorPage::PAGE_SIZE;
2121+
value = FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE;
21222122
}
21232123
// scrollbar encoder support
21242124
else if (operation == DATA_OPERATION_GET) {
21252125
value = MakeValue(1.0f * g_functionGeneratorPage.getScrollPosition(), UNIT_NONE);
21262126
} else if (operation == DATA_OPERATION_GET_MIN) {
21272127
value = MakeValue(0, UNIT_NONE);
21282128
} else if (operation == DATA_OPERATION_GET_MAX) {
2129-
value = MakeValue(1.0f * (g_functionGeneratorPage.m_selectedResources.m_numResources - FunctionGeneratorPage::PAGE_SIZE), UNIT_NONE);
2129+
value = MakeValue(1.0f * (g_functionGeneratorPage.m_selectedResources.m_numResources - FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE), UNIT_NONE);
21302130
} else if (operation == DATA_OPERATION_GET_ENCODER_STEP_VALUES) {
21312131
auto stepValues = value.getStepValues();
21322132

2133-
static float values[] = { 1.0f, 1.0f * FunctionGeneratorPage::PAGE_SIZE, 2.0f * FunctionGeneratorPage::PAGE_SIZE, 5.0f * FunctionGeneratorPage::PAGE_SIZE, 10.0f * FunctionGeneratorPage::PAGE_SIZE };
2133+
static float values[] = { 1.0f, 1.0f * FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE, 2.0f * FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE, 5.0f * FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE, 10.0f * FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE };
21342134

21352135
stepValues->values = values;
21362136
stepValues->count = sizeof(values) / sizeof(float);
21372137
stepValues->unit = UNIT_NONE;
21382138

21392139
stepValues->encoderSettings.accelerationEnabled = true;
2140-
stepValues->encoderSettings.range = 10.0f * FunctionGeneratorPage::PAGE_SIZE;
2140+
stepValues->encoderSettings.range = 10.0f * FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE;
21412141
stepValues->encoderSettings.step = 1.0f;
21422142
stepValues->encoderSettings.mode = edit_mode_step::g_scrollBarEncoderMode;
21432143

@@ -2176,7 +2176,7 @@ void data_function_generator_channels(DataOperationEnum operation, Cursor cursor
21762176
} else if (operation == DATA_OPERATION_YT_DATA_GET_POSITION_INCREMENT) {
21772177
value = 1;
21782178
} else if (operation == DATA_OPERATION_YT_DATA_GET_PAGE_SIZE) {
2179-
value = FunctionGeneratorSelectChannelsPage::PAGE_SIZE;
2179+
value = FunctionGeneratorSelectChannelsPage::FUNC_GEN_PAGE_SIZE;
21802180
}
21812181
}
21822182
}

src/eez/modules/bp3c/eeprom.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ TestResult g_testResult = TEST_FAILED;
6969
////////////////////////////////////////////////////////////////////////////////
7070

7171
#ifdef EEZ_PLATFORM_STM32
72-
const int PAGE_SIZE = 32;
72+
const int EEPROM_PAGE_SIZE = 32;
7373
#endif
7474

7575
bool read(uint8_t slotIndex, uint8_t *buffer, uint16_t bufferSize, uint16_t address) {
7676

7777
#ifdef EEZ_PLATFORM_STM32
78-
for (uint16_t i = 0; i < bufferSize; i += PAGE_SIZE) {
78+
for (uint16_t i = 0; i < bufferSize; i += EEPROM_PAGE_SIZE) {
7979
uint16_t chunkAddress = address + i;
8080

81-
uint16_t chunkSize = MIN(PAGE_SIZE, bufferSize - i);
81+
uint16_t chunkSize = MIN(EEPROM_PAGE_SIZE, bufferSize - i);
8282

8383
uint8_t data[2];
8484
data[0] = I2C_MEM_ADD_MSB(chunkAddress);
@@ -135,10 +135,10 @@ bool read(uint8_t slotIndex, uint8_t *buffer, uint16_t bufferSize, uint16_t addr
135135
bool write(uint8_t slotIndex, const uint8_t *buffer, uint16_t bufferSize, uint16_t address) {
136136

137137
#ifdef EEZ_PLATFORM_STM32
138-
for (uint16_t i = 0; i < bufferSize; i += PAGE_SIZE) {
138+
for (uint16_t i = 0; i < bufferSize; i += EEPROM_PAGE_SIZE) {
139139
uint16_t chunkAddress = address + i;
140140

141-
uint16_t chunkSize = MIN(PAGE_SIZE, bufferSize - i);
141+
uint16_t chunkSize = MIN(EEPROM_PAGE_SIZE, bufferSize - i);
142142

143143
const uint16_t eepromAddress = EEPROM_ADDRESS[slotIndex];
144144

@@ -154,7 +154,7 @@ bool write(uint8_t slotIndex, const uint8_t *buffer, uint16_t bufferSize, uint16
154154
delay(5);
155155

156156
// verify
157-
uint8_t verify[PAGE_SIZE];
157+
uint8_t verify[EEPROM_PAGE_SIZE];
158158

159159
uint8_t data[2];
160160
data[0] = I2C_MEM_ADD_MSB(chunkAddress);

src/eez/modules/psu/dlog_view.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ unsigned Parameters::setPeriod(float value) {
15061506
class DlogParamsPage : public SetPage {
15071507
public:
15081508
static Parameters g_parameters;
1509-
static const int PAGE_SIZE = 6;
1509+
static const int DLOG_VIEW_PAGE_SIZE = 6;
15101510
static int g_scrollPosition;
15111511
static float g_minPeriod;
15121512

@@ -1636,14 +1636,14 @@ class DlogParamsPage : public SetPage {
16361636
}
16371637

16381638
static void setScrollPosition(int scrollPosition) {
1639-
if (g_numDlogResources <= PAGE_SIZE) {
1639+
if (g_numDlogResources <= DLOG_VIEW_PAGE_SIZE) {
16401640
return;
16411641
}
16421642

16431643
if (scrollPosition < 0) {
16441644
scrollPosition = 0;
1645-
} else if (scrollPosition > g_numDlogResources - PAGE_SIZE) {
1646-
scrollPosition = g_numDlogResources - PAGE_SIZE;
1645+
} else if (scrollPosition > g_numDlogResources - DLOG_VIEW_PAGE_SIZE) {
1646+
scrollPosition = g_numDlogResources - DLOG_VIEW_PAGE_SIZE;
16471647
}
16481648

16491649
if (scrollPosition != DlogParamsPage::g_scrollPosition) {
@@ -1911,7 +1911,7 @@ void data_recording_ready(DataOperationEnum operation, Cursor cursor, Value &val
19111911

19121912
void data_dlog_items_scrollbar_enabled(DataOperationEnum operation, Cursor cursor, Value &value) {
19131913
if (operation == DATA_OPERATION_GET) {
1914-
value = DlogParamsPage::getNumDlogResources() > DlogParamsPage::PAGE_SIZE;
1914+
value = DlogParamsPage::getNumDlogResources() > DlogParamsPage::DLOG_VIEW_PAGE_SIZE;
19151915
}
19161916
}
19171917

@@ -1952,7 +1952,7 @@ void data_dlog_items(DataOperationEnum operation, Cursor cursor, Value &value) {
19521952
} else if (operation == DATA_OPERATION_YT_DATA_GET_POSITION_INCREMENT) {
19531953
value = 1;
19541954
} else if (operation == DATA_OPERATION_YT_DATA_GET_PAGE_SIZE) {
1955-
value = DlogParamsPage::PAGE_SIZE;
1955+
value = DlogParamsPage::DLOG_VIEW_PAGE_SIZE;
19561956
}
19571957
}
19581958

src/eez/modules/psu/gui/data.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -5609,7 +5609,7 @@ void data_ramp_and_delay_list(DataOperationEnum operation, Cursor cursor, Value
56095609
return;
56105610
}
56115611

5612-
static const int PAGE_SIZE = 4;
5612+
static const int RAMP_AND_DELAY_PAGE_SIZE = 4;
56135613

56145614
if (operation == DATA_OPERATION_COUNT) {
56155615
value = CH_NUM;
@@ -5621,15 +5621,15 @@ void data_ramp_and_delay_list(DataOperationEnum operation, Cursor cursor, Value
56215621
int32_t newPosition = value.getUInt32();
56225622
if (newPosition < 0) {
56235623
page->startChannel = 0;
5624-
} else if (newPosition + PAGE_SIZE > CH_NUM) {
5625-
page->startChannel = CH_NUM - PAGE_SIZE;
5624+
} else if (newPosition + RAMP_AND_DELAY_PAGE_SIZE > CH_NUM) {
5625+
page->startChannel = CH_NUM - RAMP_AND_DELAY_PAGE_SIZE;
56265626
} else {
56275627
page->startChannel = newPosition;
56285628
}
56295629
} else if (operation == DATA_OPERATION_YT_DATA_GET_POSITION_INCREMENT) {
56305630
value = Value(1, VALUE_TYPE_UINT32);
56315631
} else if (operation == DATA_OPERATION_YT_DATA_GET_PAGE_SIZE) {
5632-
value = Value(PAGE_SIZE, VALUE_TYPE_UINT32);
5632+
value = Value(RAMP_AND_DELAY_PAGE_SIZE, VALUE_TYPE_UINT32);
56335633
} else if (operation == DATA_OPERATION_SELECT) {
56345634
value = Value(g_channel, VALUE_TYPE_POINTER);
56355635
selectChannel(&Channel::get(page->startChannel + cursor));

0 commit comments

Comments
 (0)