From 8782700cac0c8e12fc7cf8ed87654f33ef8bafb2 Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Wed, 30 Nov 2022 16:56:03 +0100 Subject: [PATCH] fix emscripten build --- src/eez/function_generator.cpp | 30 +++++++++++++++--------------- src/eez/modules/bp3c/eeprom.cpp | 12 ++++++------ src/eez/modules/psu/dlog_view.cpp | 12 ++++++------ src/eez/modules/psu/gui/data.cpp | 8 ++++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/eez/function_generator.cpp b/src/eez/function_generator.cpp index cf0bbef11..7e1456bc3 100644 --- a/src/eez/function_generator.cpp +++ b/src/eez/function_generator.cpp @@ -327,7 +327,7 @@ float getMax(WaveformParameters &waveformParameters) { class FunctionGeneratorPage : public SetPage { public: - static const int PAGE_SIZE = 4; + static const int FUNC_GEN_PAGE_SIZE = 4; bool m_initialized = false; @@ -698,14 +698,14 @@ class FunctionGeneratorPage : public SetPage { } void setScrollPosition(int scrollPosition) { - if (g_selectedResources.m_numResources <= PAGE_SIZE) { + if (g_selectedResources.m_numResources <= FUNC_GEN_PAGE_SIZE) { return; } if (scrollPosition < 0) { scrollPosition = 0; - } else if (scrollPosition > g_selectedResources.m_numResources - PAGE_SIZE) { - scrollPosition = g_selectedResources.m_numResources - PAGE_SIZE; + } else if (scrollPosition > g_selectedResources.m_numResources - FUNC_GEN_PAGE_SIZE) { + scrollPosition = g_selectedResources.m_numResources - FUNC_GEN_PAGE_SIZE; } if (scrollPosition != m_scrollPosition) { @@ -773,7 +773,7 @@ void initWaveformParameters(WaveformParameters &waveformParameters) { class FunctionGeneratorSelectChannelsPage : public SetPage { public: - static const int PAGE_SIZE = 7; + static const int FUNC_GEN_PAGE_SIZE = 7; void pageAlloc() { AllResources::reset(); @@ -839,14 +839,14 @@ class FunctionGeneratorSelectChannelsPage : public SetPage { } void setScrollPosition(int scrollPosition) { - if (AllResources::getNumResources() <= PAGE_SIZE) { + if (AllResources::getNumResources() <= FUNC_GEN_PAGE_SIZE) { return; } if (scrollPosition < 0) { scrollPosition = 0; - } else if (scrollPosition > AllResources::getNumResources() - PAGE_SIZE) { - scrollPosition = AllResources::getNumResources() - PAGE_SIZE; + } else if (scrollPosition > AllResources::getNumResources() - FUNC_GEN_PAGE_SIZE) { + scrollPosition = AllResources::getNumResources() - FUNC_GEN_PAGE_SIZE; } if (scrollPosition != m_scrollPosition) { @@ -1180,8 +1180,8 @@ void selectWaveformParametersForChannel(int slotIndex, int subchannelIndex, int if (tmpSlotIndex == slotIndex && tmpSubchannelIndex == subchannelIndex && (resourceIndex == -1 || tmpResourceIndex == resourceIndex)) { g_functionGeneratorPage.m_selectedItem = i; - if (i >= FunctionGeneratorPage::PAGE_SIZE) { - g_functionGeneratorPage.setScrollPosition(i - FunctionGeneratorPage::PAGE_SIZE + 1); + if (i >= FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE) { + g_functionGeneratorPage.setScrollPosition(i - FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE + 1); } break; @@ -2118,7 +2118,7 @@ void data_function_generator_channels(DataOperationEnum operation, Cursor cursor } else if (operation == DATA_OPERATION_YT_DATA_GET_POSITION_INCREMENT) { value = 1; } else if (operation == DATA_OPERATION_YT_DATA_GET_PAGE_SIZE) { - value = FunctionGeneratorPage::PAGE_SIZE; + value = FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE; } // scrollbar encoder support else if (operation == DATA_OPERATION_GET) { @@ -2126,18 +2126,18 @@ void data_function_generator_channels(DataOperationEnum operation, Cursor cursor } else if (operation == DATA_OPERATION_GET_MIN) { value = MakeValue(0, UNIT_NONE); } else if (operation == DATA_OPERATION_GET_MAX) { - value = MakeValue(1.0f * (g_functionGeneratorPage.m_selectedResources.m_numResources - FunctionGeneratorPage::PAGE_SIZE), UNIT_NONE); + value = MakeValue(1.0f * (g_functionGeneratorPage.m_selectedResources.m_numResources - FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE), UNIT_NONE); } else if (operation == DATA_OPERATION_GET_ENCODER_STEP_VALUES) { auto stepValues = value.getStepValues(); - 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 }; + 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 }; stepValues->values = values; stepValues->count = sizeof(values) / sizeof(float); stepValues->unit = UNIT_NONE; stepValues->encoderSettings.accelerationEnabled = true; - stepValues->encoderSettings.range = 10.0f * FunctionGeneratorPage::PAGE_SIZE; + stepValues->encoderSettings.range = 10.0f * FunctionGeneratorPage::FUNC_GEN_PAGE_SIZE; stepValues->encoderSettings.step = 1.0f; stepValues->encoderSettings.mode = edit_mode_step::g_scrollBarEncoderMode; @@ -2176,7 +2176,7 @@ void data_function_generator_channels(DataOperationEnum operation, Cursor cursor } else if (operation == DATA_OPERATION_YT_DATA_GET_POSITION_INCREMENT) { value = 1; } else if (operation == DATA_OPERATION_YT_DATA_GET_PAGE_SIZE) { - value = FunctionGeneratorSelectChannelsPage::PAGE_SIZE; + value = FunctionGeneratorSelectChannelsPage::FUNC_GEN_PAGE_SIZE; } } } diff --git a/src/eez/modules/bp3c/eeprom.cpp b/src/eez/modules/bp3c/eeprom.cpp index aa81d7a25..58eebb33b 100644 --- a/src/eez/modules/bp3c/eeprom.cpp +++ b/src/eez/modules/bp3c/eeprom.cpp @@ -69,16 +69,16 @@ TestResult g_testResult = TEST_FAILED; //////////////////////////////////////////////////////////////////////////////// #ifdef EEZ_PLATFORM_STM32 -const int PAGE_SIZE = 32; +const int EEPROM_PAGE_SIZE = 32; #endif bool read(uint8_t slotIndex, uint8_t *buffer, uint16_t bufferSize, uint16_t address) { #ifdef EEZ_PLATFORM_STM32 - for (uint16_t i = 0; i < bufferSize; i += PAGE_SIZE) { + for (uint16_t i = 0; i < bufferSize; i += EEPROM_PAGE_SIZE) { uint16_t chunkAddress = address + i; - uint16_t chunkSize = MIN(PAGE_SIZE, bufferSize - i); + uint16_t chunkSize = MIN(EEPROM_PAGE_SIZE, bufferSize - i); uint8_t data[2]; 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 bool write(uint8_t slotIndex, const uint8_t *buffer, uint16_t bufferSize, uint16_t address) { #ifdef EEZ_PLATFORM_STM32 - for (uint16_t i = 0; i < bufferSize; i += PAGE_SIZE) { + for (uint16_t i = 0; i < bufferSize; i += EEPROM_PAGE_SIZE) { uint16_t chunkAddress = address + i; - uint16_t chunkSize = MIN(PAGE_SIZE, bufferSize - i); + uint16_t chunkSize = MIN(EEPROM_PAGE_SIZE, bufferSize - i); const uint16_t eepromAddress = EEPROM_ADDRESS[slotIndex]; @@ -154,7 +154,7 @@ bool write(uint8_t slotIndex, const uint8_t *buffer, uint16_t bufferSize, uint16 delay(5); // verify - uint8_t verify[PAGE_SIZE]; + uint8_t verify[EEPROM_PAGE_SIZE]; uint8_t data[2]; data[0] = I2C_MEM_ADD_MSB(chunkAddress); diff --git a/src/eez/modules/psu/dlog_view.cpp b/src/eez/modules/psu/dlog_view.cpp index 0c64fca41..82ca2ac80 100644 --- a/src/eez/modules/psu/dlog_view.cpp +++ b/src/eez/modules/psu/dlog_view.cpp @@ -1506,7 +1506,7 @@ unsigned Parameters::setPeriod(float value) { class DlogParamsPage : public SetPage { public: static Parameters g_parameters; - static const int PAGE_SIZE = 6; + static const int DLOG_VIEW_PAGE_SIZE = 6; static int g_scrollPosition; static float g_minPeriod; @@ -1636,14 +1636,14 @@ class DlogParamsPage : public SetPage { } static void setScrollPosition(int scrollPosition) { - if (g_numDlogResources <= PAGE_SIZE) { + if (g_numDlogResources <= DLOG_VIEW_PAGE_SIZE) { return; } if (scrollPosition < 0) { scrollPosition = 0; - } else if (scrollPosition > g_numDlogResources - PAGE_SIZE) { - scrollPosition = g_numDlogResources - PAGE_SIZE; + } else if (scrollPosition > g_numDlogResources - DLOG_VIEW_PAGE_SIZE) { + scrollPosition = g_numDlogResources - DLOG_VIEW_PAGE_SIZE; } if (scrollPosition != DlogParamsPage::g_scrollPosition) { @@ -1911,7 +1911,7 @@ void data_recording_ready(DataOperationEnum operation, Cursor cursor, Value &val void data_dlog_items_scrollbar_enabled(DataOperationEnum operation, Cursor cursor, Value &value) { if (operation == DATA_OPERATION_GET) { - value = DlogParamsPage::getNumDlogResources() > DlogParamsPage::PAGE_SIZE; + value = DlogParamsPage::getNumDlogResources() > DlogParamsPage::DLOG_VIEW_PAGE_SIZE; } } @@ -1952,7 +1952,7 @@ void data_dlog_items(DataOperationEnum operation, Cursor cursor, Value &value) { } else if (operation == DATA_OPERATION_YT_DATA_GET_POSITION_INCREMENT) { value = 1; } else if (operation == DATA_OPERATION_YT_DATA_GET_PAGE_SIZE) { - value = DlogParamsPage::PAGE_SIZE; + value = DlogParamsPage::DLOG_VIEW_PAGE_SIZE; } } diff --git a/src/eez/modules/psu/gui/data.cpp b/src/eez/modules/psu/gui/data.cpp index ce628479a..e229724bd 100644 --- a/src/eez/modules/psu/gui/data.cpp +++ b/src/eez/modules/psu/gui/data.cpp @@ -5609,7 +5609,7 @@ void data_ramp_and_delay_list(DataOperationEnum operation, Cursor cursor, Value return; } - static const int PAGE_SIZE = 4; + static const int RAMP_AND_DELAY_PAGE_SIZE = 4; if (operation == DATA_OPERATION_COUNT) { value = CH_NUM; @@ -5621,15 +5621,15 @@ void data_ramp_and_delay_list(DataOperationEnum operation, Cursor cursor, Value int32_t newPosition = value.getUInt32(); if (newPosition < 0) { page->startChannel = 0; - } else if (newPosition + PAGE_SIZE > CH_NUM) { - page->startChannel = CH_NUM - PAGE_SIZE; + } else if (newPosition + RAMP_AND_DELAY_PAGE_SIZE > CH_NUM) { + page->startChannel = CH_NUM - RAMP_AND_DELAY_PAGE_SIZE; } else { page->startChannel = newPosition; } } else if (operation == DATA_OPERATION_YT_DATA_GET_POSITION_INCREMENT) { value = Value(1, VALUE_TYPE_UINT32); } else if (operation == DATA_OPERATION_YT_DATA_GET_PAGE_SIZE) { - value = Value(PAGE_SIZE, VALUE_TYPE_UINT32); + value = Value(RAMP_AND_DELAY_PAGE_SIZE, VALUE_TYPE_UINT32); } else if (operation == DATA_OPERATION_SELECT) { value = Value(g_channel, VALUE_TYPE_POINTER); selectChannel(&Channel::get(page->startChannel + cursor));