Skip to content

Commit

Permalink
dcm224
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Apr 16, 2020
1 parent e91de27 commit dc3636b
Show file tree
Hide file tree
Showing 14 changed files with 26,976 additions and 25,410 deletions.
Binary file added images/Module DCM224.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
190 changes: 190 additions & 0 deletions modular-psu-firmware.eez-project

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions scripts/Module Initialization/Module Initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
MODEL_DCP405 = 1
MODEL_DCP405B = 2
MODEL_DCM220 = 3
MODEL_DCM224 = 4

MODELS = [
{ "name": "None", "id": 0, "r": 0, "b": 0 },
{ "name": "DCP405", "id": 405, "r": 2, "b": 11 },
{ "name": "DCP405B", "id": 406, "r": 2, "b": 11 },
{ "name": "DCM220", "id": 220, "r": 2, "b": 8 },
{ "name": "DCM224", "id": 224, "r": 1, "b": 1 },
]

slots = [
Expand Down
2 changes: 1 addition & 1 deletion src/eez/action_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ void onFirmwareSelected(const char *filePath) {
}

void onSelectFirmware() {
file_manager::browseForFile("Select DCM220 firmware file", "/Updates", FILE_TYPE_HEX, file_manager::DIALOG_TYPE_OPEN, onFirmwareSelected);
file_manager::browseForFile("Select firmware file", "/Updates", FILE_TYPE_HEX, file_manager::DIALOG_TYPE_OPEN, onFirmwareSelected);
}

void action_channel_update_firmware() {
Expand Down
52,114 changes: 26,733 additions & 25,381 deletions src/eez/gui/document_simulator.cpp

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions src/eez/gui/document_simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,8 @@ enum BitmapsEnum {
BITMAP_ID_FRONT_PANEL = 14,
BITMAP_ID_DCP405 = 15,
BITMAP_ID_DCP405_B = 16,
BITMAP_ID_DCM220 = 17
BITMAP_ID_DCM220 = 17,
BITMAP_ID_DCM224 = 18
};

enum StylesEnum {
Expand Down Expand Up @@ -1846,15 +1847,16 @@ enum PagesEnum {
PAGE_ID_DCP405B_FRONT_PANEL = 155,
PAGE_ID_DCM220_FRONT_PANEL = 156,
PAGE_ID_DCM220_FRONT_PANEL_LED = 157,
PAGE_ID_FRONT_PANEL_NUMERIC_KEYPAD = 158,
PAGE_ID_FILE_MANAGER_DETAILS_VIEW = 159,
PAGE_ID_FILE_MANAGER_SCRIPTS_VIEW = 160,
PAGE_ID_FILE_MANAGER_SCRIPTS_ALTER_VIEW = 161,
PAGE_ID_FILE_MANAGER_LARGE_ICONS_VIEW = 162,
PAGE_ID_TOUCH_TEST = 163,
PAGE_ID_DEBUG_VARIABLES = 164,
PAGE_ID_FOCUS_VALUE_OVERLAY = 165,
PAGE_ID_OVP_TYPE = 166
PAGE_ID_DCM224_FRONT_PANEL = 158,
PAGE_ID_FRONT_PANEL_NUMERIC_KEYPAD = 159,
PAGE_ID_FILE_MANAGER_DETAILS_VIEW = 160,
PAGE_ID_FILE_MANAGER_SCRIPTS_VIEW = 161,
PAGE_ID_FILE_MANAGER_SCRIPTS_ALTER_VIEW = 162,
PAGE_ID_FILE_MANAGER_LARGE_ICONS_VIEW = 163,
PAGE_ID_TOUCH_TEST = 164,
PAGE_ID_DEBUG_VARIABLES = 165,
PAGE_ID_FOCUS_VALUE_OVERLAY = 166,
PAGE_ID_OVP_TYPE = 167
};

extern const uint8_t assets[413884];
extern const uint8_t assets[435505];
7 changes: 7 additions & 0 deletions src/eez/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ static ModuleInfo g_modules[] = {
MODULE_REVISION_DCM220_R2B4,
2,
dcm220::g_channelInterfaces
},
{
MODULE_TYPE_DCM224,
"DCM224",
MODULE_REVISION_DCM224_R1B1,
2,
dcm220::g_channelInterfaces
}
};

Expand Down
3 changes: 3 additions & 0 deletions src/eez/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ static const uint16_t MODULE_TYPE_DCP405 = 405;
static const uint16_t MODULE_TYPE_DCP405B = 406;
static const uint16_t MODULE_TYPE_DCP505 = 505;
static const uint16_t MODULE_TYPE_DCM220 = 220;
static const uint16_t MODULE_TYPE_DCM224 = 224;

static const uint16_t MODULE_REVISION_DCP405_R1B1 = 0x0101;
static const uint16_t MODULE_REVISION_DCP405_R2B5 = 0x0205;
Expand All @@ -214,6 +215,8 @@ static const uint16_t MODULE_REVISION_DCP505_R1B3 = 0x0103;

static const uint16_t MODULE_REVISION_DCM220_R2B4 = 0x0204;

static const uint16_t MODULE_REVISION_DCM224_R1B1 = 0x0101;

struct ModuleInfo {
uint16_t moduleType;
const char *moduleName;
Expand Down
27 changes: 17 additions & 10 deletions src/eez/modules/dcm220/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,31 +178,33 @@ struct Channel : ChannelInterface {
}

void getParams(int subchannelIndex, ChannelParams &params) {
auto slot = g_slots[slotIndex];

params.U_MIN = 1.0f;
params.U_DEF = 1.0f;
params.U_MAX = 20.0f;
params.U_MAX = slot.moduleInfo->moduleType == MODULE_TYPE_DCM224 ? 24.0f : 20.0f;

params.U_MIN_STEP = 0.01f;
params.U_DEF_STEP = 0.1f;
params.U_MAX_STEP = 5.0f;

params.U_CAL_VAL_MIN = 2.0f;
params.U_CAL_VAL_MID = 10.0f;
params.U_CAL_VAL_MAX = 18.0f;
params.U_CAL_VAL_MID = slot.moduleInfo->moduleType == MODULE_TYPE_DCM224 ? 12.0f : 10.0f;
params.U_CAL_VAL_MAX = slot.moduleInfo->moduleType == MODULE_TYPE_DCM224 ? 22.0f : 18.0f;
params.I_VOLT_CAL = 1.0f;

params.I_MIN = 0.0f;
params.I_DEF = 0.0f;
params.I_MAX = 4.0f;
params.I_MAX = slot.moduleInfo->moduleType == MODULE_TYPE_DCM224 ? 5.0f : 4.0f;

params.I_MIN_STEP = 0.01f;
params.I_DEF_STEP = 0.01f;
params.I_MAX_STEP = 1.0f;

params.I_CAL_VAL_MIN = 0.5f;
params.I_CAL_VAL_MID = 2.0f;
params.I_CAL_VAL_MAX = 3.5f;
params.U_CURR_CAL = 20.0f;
params.I_CAL_VAL_MID = slot.moduleInfo->moduleType == MODULE_TYPE_DCM224 ? 2.5f : 2.0f;
params.I_CAL_VAL_MAX = slot.moduleInfo->moduleType == MODULE_TYPE_DCM224 ? 4.5f : 3.5f;
params.U_CURR_CAL = slot.moduleInfo->moduleType == MODULE_TYPE_DCM224 ? 25.0f : 20.0f;

params.OVP_DEFAULT_STATE = false;
params.OVP_MIN_DELAY = 0.0f;
Expand Down Expand Up @@ -601,9 +603,14 @@ ChannelInterface *g_channelInterfaces[NUM_SLOTS] = { &g_channel0, &g_channel1, &
float readTemperature(int channelIndex) {
psu::Channel& channel = psu::Channel::get(channelIndex);
int slotIndex = channel.slotIndex;
int subchannelIndex = channel.subchannelIndex;
Channel *dcm220Channel = (Channel *)g_channelInterfaces[slotIndex];
return dcm220Channel->temperature[subchannelIndex];
auto slot = g_slots[slotIndex];
if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM224) {
// TODO this is temporary until module hardware is changed
return 25 + 5 * channel.i.set;
} else {
Channel *dcm220Channel = (Channel *)g_channelInterfaces[slotIndex];
return dcm220Channel->temperature[channel.subchannelIndex];
}
}

#endif
Expand Down
2 changes: 1 addition & 1 deletion src/eez/modules/psu/calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool Value::checkRange(float dac, float data, float adc) {
return false;
}

if (g_slots[g_channel->slotIndex].moduleInfo->moduleType != MODULE_TYPE_DCM220) {
if (g_slots[g_channel->slotIndex].moduleInfo->moduleType != MODULE_TYPE_DCM220 && g_slots[g_channel->slotIndex].moduleInfo->moduleType != MODULE_TYPE_DCM224) {
diff = fabsf(dac - adc);
if (diff > allowedDiff) {
DebugTrace("ADC check failed: level=%f, adc=%f, diff=%f, allowedDiff=%f\n", dac, adc, diff, allowedDiff);
Expand Down
7 changes: 4 additions & 3 deletions src/eez/modules/psu/gui/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ EnumItem g_enumDefinition_MODULE_TYPE[] = {
{ MODULE_TYPE_DCP405, "DCP405" },
{ MODULE_TYPE_DCP405B, "DCP405B" },
{ MODULE_TYPE_DCM220, "DCM220" },
{ MODULE_TYPE_DCM224, "DCM224" },
{ 0, 0 }
};

Expand Down Expand Up @@ -2763,7 +2764,7 @@ void data_module_specific_ch_settings(DataOperationEnum operation, Cursor cursor
value = PAGE_ID_CH_SETTINGS_DCP405_SPECIFIC;
} else if (modulType == MODULE_TYPE_DCP405B) {
value = PAGE_ID_CH_SETTINGS_DCP405B_SPECIFIC;
} else if (modulType == MODULE_TYPE_DCM220) {
} else if (modulType == MODULE_TYPE_DCM220 || modulType == MODULE_TYPE_DCM224) {
value = PAGE_ID_CH_SETTINGS_DCM220_SPECIFIC;
} else {
value = PAGE_ID_NONE;
Expand All @@ -2776,7 +2777,7 @@ void data_channel_has_error_settings(DataOperationEnum operation, Cursor cursor,
int iChannel = cursor >= 0 ? cursor : (g_channel ? g_channel->channelIndex : 0);
Channel &channel = Channel::get(iChannel);
auto modulType = g_slots[channel.slotIndex].moduleInfo->moduleType;
if (modulType == MODULE_TYPE_DCM220) {
if (modulType == MODULE_TYPE_DCM220 || modulType == MODULE_TYPE_DCM224) {
value = 1;
} else {
value = 0;
Expand All @@ -2792,7 +2793,7 @@ void data_channel_settings_page(DataOperationEnum operation, Cursor cursor, Valu
value = PAGE_ID_CH_SETTINGS_OK;
} else {
auto modulType = g_slots[channel.slotIndex].moduleInfo->moduleType;
if (modulType == MODULE_TYPE_DCM220) {
if (modulType == MODULE_TYPE_DCM220 || modulType == MODULE_TYPE_DCM224) {
uint8_t firmwareMajorVersion;
uint8_t firmwareMinorVersion;
channel.getFirmwareVersion(firmwareMajorVersion, firmwareMinorVersion);
Expand Down
2 changes: 1 addition & 1 deletion src/eez/modules/psu/temp_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ float TempSensor::doRead() {
return drivers::tmp1075::readTemperature(slotIndex);
}

if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM220) {
if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM220 || slot.moduleInfo->moduleType == MODULE_TYPE_DCM224) {
return dcm220::readTemperature(channelIndex);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/eez/platform/simulator/front_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ int getSlotView(int channelIndex) {
return PAGE_ID_DCP405B_FRONT_PANEL;
} else if (g_slots[slotIndex].moduleInfo->moduleType == MODULE_TYPE_DCM220) {
return PAGE_ID_DCM220_FRONT_PANEL;
} else if (g_slots[slotIndex].moduleInfo->moduleType == MODULE_TYPE_DCM224) {
return PAGE_ID_DCM224_FRONT_PANEL;
} else {
return PAGE_ID_FRONT_PANEL_EMPTY_SLOT;
}
Expand Down
4 changes: 2 additions & 2 deletions src/eez/platform/stm32/spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void select(uint8_t slotIndex, int chip) {

auto &slot = g_slots[slotIndex];

if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM220) {
if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM220 || slot.moduleInfo->moduleType == MODULE_TYPE_DCM224) {
selectA(slotIndex);
return;
}
Expand Down Expand Up @@ -137,7 +137,7 @@ void select(uint8_t slotIndex, int chip) {

void deselect(uint8_t slotIndex) {
auto &slot = g_slots[slotIndex];
if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM220) {
if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM220 || slot.moduleInfo->moduleType == MODULE_TYPE_DCM224) {
deselectA(slotIndex);
} else if (slot.moduleInfo->moduleType == MODULE_TYPE_DCP405 || slot.moduleInfo->moduleType == MODULE_TYPE_DCP405B) {
// 01 ADC
Expand Down

0 comments on commit dc3636b

Please sign in to comment.