Skip to content

Commit

Permalink
nplc
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jan 13, 2021
1 parent c2db005 commit 708fc66
Show file tree
Hide file tree
Showing 30 changed files with 29,024 additions and 27,102 deletions.
512 changes: 410 additions & 102 deletions modular-psu-firmware.eez-project

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/eez/action_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,11 @@ void action_module_resync() {
sendMessageToPsu(PSU_MESSAGE_MODULE_RESYNC, hmi::g_selectedSlotIndex);
}

void action_select_ac_mains() {
SysSettingsDateTimePage *page = (SysSettingsDateTimePage *)getPage(PAGE_ID_SYS_SETTINGS_DATE_TIME);
page->powerLineFrequency = page->powerLineFrequency == 50 ? 60 : 50;
}

} // namespace gui
} // namespace eez

Expand Down
9,819 changes: 4,933 additions & 4,886 deletions src/eez/gui/document_simulator.cpp

Large diffs are not rendered by default.

690 changes: 360 additions & 330 deletions src/eez/gui/document_simulator.h

Large diffs are not rendered by default.

41,888 changes: 20,966 additions & 20,922 deletions src/eez/gui/document_stm32.cpp

Large diffs are not rendered by default.

630 changes: 330 additions & 300 deletions src/eez/gui/document_stm32.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/eez/gui/widgets/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ EnumFunctionType SELECT_enum = [](WidgetCursor &widgetCursor, EnumWidgetsCallbac

const ContainerWidget *containerWidget = GET_WIDGET_PROPERTY(widgetCursor.widget, specific, const ContainerWidget *);

widgetCursor.widget = GET_WIDGET_LIST_ELEMENT(containerWidget->widgets, + indexValue.getInt());
widgetCursor.widget = GET_WIDGET_LIST_ELEMENT(containerWidget->widgets, indexValue.getInt());

enumWidget(widgetCursor, callback);

Expand Down
33 changes: 28 additions & 5 deletions src/eez/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,29 +452,29 @@ bool Module::setMeasureVoltageRange(int subchannelIndex, uint8_t range, int *err
return false;
}

bool Module::getMeasureCurrentNumPowerLineCycles(int subchannelIndex, uint8_t &numPowerLineCycles, int *err) {
bool Module::getMeasureCurrentNPLC(int subchannelIndex, float &nplc, int *err) {
if (err) {
*err = SCPI_ERROR_HARDWARE_MISSING;
}
return false;
}

bool Module::setMeasureCurrentNumPowerLineCycles(int subchannelIndex, uint8_t numPowerLineCycles, int *err) {
bool Module::setMeasureCurrentNPLC(int subchannelIndex, float nplc, int *err) {
if (err) {
*err = SCPI_ERROR_HARDWARE_MISSING;
}
return false;
}

bool Module::getMeasureVoltageNumPowerLineCycles(int subchannelIndex, uint8_t &numPowerLineCycles, int *err) {
bool Module::getMeasureVoltageNPLC(int subchannelIndex, float &nplc, int *err) {
if (err) {
*err = SCPI_ERROR_HARDWARE_MISSING;
}
return false;
}

bool Module::setMeasureVoltageNumPowerLineCycles(int subchannelIndex, uint8_t numPowerLineCycles, int *err) {
if (err) {
bool Module::setMeasureVoltageNPLC(int subchannelIndex, float nplc, int *err) {
if (err) {
*err = SCPI_ERROR_HARDWARE_MISSING;
}
return false;
Expand Down Expand Up @@ -687,9 +687,24 @@ bool Module::saveChannelCalibration(int subchannelIndex, int *err) {
return false;
}

void Module::initChannelCalibration(int subchannelIndex) {
}

void Module::startChannelCalibration(int subchannelIndex) {
}

bool Module::calibrationReadAdcValue(int subchannelIndex, float &adcValue, int *err) {
adcValue = 0.0f;
return true;
}

bool Module::calibrationMeasure(int subchannelIndex, float &measuredValue, int *err) {
if (err) {
*err = SCPI_ERROR_BAD_SEQUENCE_OF_CALIBRATION_COMMANDS;
}
return false;
}

void Module::stopChannelCalibration(int subchannelIndex) {
}

Expand All @@ -701,6 +716,14 @@ CalibrationValueType Module::getCalibrationValueType(int subchannelIndex) {
return CALIBRATION_VALUE_U;
}

const char *Module::getCalibrationValueRangeDescription(int subchannelIndex) {
return nullptr;
}

bool Module::isCalibrationValueSource(int subchannelIndex) {
return true;
}

void Module::getDefaultCalibrationPoints(int subchannelIndex, CalibrationValueType type, unsigned int &numPoints, float *&points) {
numPoints = 0;
points = nullptr;
Expand Down
13 changes: 9 additions & 4 deletions src/eez/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ struct Module {
virtual bool getMeasureVoltageRange(int subchannelIndex, uint8_t &range, int *err);
virtual bool setMeasureVoltageRange(int subchannelIndex, uint8_t range, int *err);

virtual bool getMeasureCurrentNumPowerLineCycles(int subchannelIndex, uint8_t &numPowerLineCycles, int *err);
virtual bool setMeasureCurrentNumPowerLineCycles(int subchannelIndex, uint8_t numPowerLineCycles, int *err);
virtual bool getMeasureCurrentNPLC(int subchannelIndex, float &nplc, int *err);
virtual bool setMeasureCurrentNPLC(int subchannelIndex, float nplc, int *err);

virtual bool getMeasureVoltageNumPowerLineCycles(int subchannelIndex, uint8_t &numPowerLineCycles, int *err);
virtual bool setMeasureVoltageNumPowerLineCycles(int subchannelIndex, uint8_t numPowerLineCycles, int *err);
virtual bool getMeasureVoltageNPLC(int subchannelIndex, float &nplc, int *err);
virtual bool setMeasureVoltageNPLC(int subchannelIndex, float nplc, int *err);

virtual bool isRouteOpen(int subchannelIndex, bool &isRouteOpen, int *err);
virtual bool routeOpen(ChannelList channelList, int *err);
Expand Down Expand Up @@ -356,10 +356,15 @@ struct Module {

virtual bool loadChannelCalibration(int subchannelIndex, int *err);
virtual bool saveChannelCalibration(int subchannelIndex, int *err);
virtual void initChannelCalibration(int subchannelIndex);
virtual void startChannelCalibration(int subchannelIndex);
virtual bool calibrationReadAdcValue(int subchannelIndex, float &adcValue, int *err);
virtual bool calibrationMeasure(int subchannelIndex, float &measuredValue, int *err);
virtual void stopChannelCalibration(int subchannelIndex);
virtual unsigned int getMaxCalibrationPoints(int m_subchannelIndex);
virtual CalibrationValueType getCalibrationValueType(int subchannelIndex);
virtual const char *getCalibrationValueRangeDescription(int subchannelIndex);
virtual bool isCalibrationValueSource(int subchannelIndex);
virtual void getDefaultCalibrationPoints(int subchannelIndex, CalibrationValueType type, unsigned int &numPoints, float *&points);
virtual bool getCalibrationConfiguration(int subchannelIndex, CalibrationConfiguration &calConf, int *err);
virtual bool setCalibrationConfiguration(int subchannelIndex, const CalibrationConfiguration &calConf, int *err);
Expand Down
3 changes: 3 additions & 0 deletions src/eez/modules/bp3c/flash_slave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ void leaveBootloaderMode() {
osDelay(5);
io_exp::hardResetModules();

// give some time to the modules to initialize
osDelay(100);

psu::initChannels();
psu::testChannels();
#endif
Expand Down
Loading

0 comments on commit 708fc66

Please sign in to comment.