Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jun 15, 2021
1 parent ee2abbc commit 145a8e7
Show file tree
Hide file tree
Showing 30 changed files with 65,745 additions and 70,838 deletions.
322 changes: 23 additions & 299 deletions modular-psu-firmware.eez-project

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/eez/action_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,17 +599,14 @@ void action_toggle_channels_max_view() {
selectChannelByCursor();

auto isMaxViewBefore = persist_conf::isMaxView();
auto wasFullScreenView = isMaxViewBefore && isSlotFullScreenView();
auto maxSlotIndexBefore = isMaxViewBefore ? persist_conf::getMaxSlotIndex() : -1;

persist_conf::toggleMaxChannelIndex(g_channel->channelIndex);

if (!isMaxViewBefore && persist_conf::isMaxView()) {
animateFromDefaultViewToMaxView(g_channel->slotIndex, isSlotFullScreenView());
} else if (isMaxViewBefore && !persist_conf::isMaxView()) {
animateFromMaxViewToDefaultView(maxSlotIndexBefore, wasFullScreenView);
animateFromDefaultViewToMaxView(g_channel->slotIndex);
} else {
animateFromMinViewToMaxView(maxSlotIndexBefore, isSlotFullScreenView());
animateFromMaxViewToDefaultView(maxSlotIndexBefore);
}
}

Expand All @@ -618,17 +615,14 @@ void action_toggle_slot_max_view() {
hmi::selectSlot(slotIndex);

auto isMaxViewBefore = persist_conf::isMaxView();
auto wasFullScreenView = isMaxViewBefore && isSlotFullScreenView();
auto maxSlotIndexBefore = isMaxViewBefore ? persist_conf::getMaxSlotIndex() : -1;

persist_conf::toggleMaxSlotIndex(slotIndex);

if (!isMaxViewBefore && persist_conf::isMaxView()) {
animateFromDefaultViewToMaxView(slotIndex, isSlotFullScreenView());
} else if (isMaxViewBefore && !persist_conf::isMaxView()) {
animateFromMaxViewToDefaultView(maxSlotIndexBefore, wasFullScreenView);
animateFromDefaultViewToMaxView(slotIndex);
} else {
animateFromMinViewToMaxView(maxSlotIndexBefore, isSlotFullScreenView());
animateFromMaxViewToDefaultView(maxSlotIndexBefore);
}
}

Expand Down Expand Up @@ -1391,6 +1385,12 @@ void action_toggle_overlay_minimized() {
persist_conf::devConf.overlayVisibility | OVERLAY_MINIMIZED);
}

void action_hide_overlay_long_touch() {
if (g_isLongTouch) {
persist_conf::setOverlayVisibility(persist_conf::devConf.overlayVisibility | OVERLAY_HIDDEN);
}
}

void action_hide_overlay() {
persist_conf::setOverlayVisibility(persist_conf::devConf.overlayVisibility | OVERLAY_HIDDEN);
}
Expand Down
26 changes: 19 additions & 7 deletions src/eez/function_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,15 @@ FunctionGeneratorOptions g_options = {
};

WaveformFunction g_waveFormFuncU[CH_MAX];
float g_phaseShiftU[CH_MAX];
float g_phiU[CH_MAX];
float g_dphiU[CH_MAX];
float g_amplitudeU[CH_MAX];
float g_offsetU[CH_MAX];
float g_dutyCycleU[CH_MAX];

WaveformFunction g_waveFormFuncI[CH_MAX];
float g_phaseShiftI[CH_MAX];
float g_phiI[CH_MAX];
float g_dphiI[CH_MAX];
float g_amplitudeI[CH_MAX];
Expand Down Expand Up @@ -1502,13 +1504,17 @@ void reloadWaveformParameters() {

for (int i = 0; i < CH_MAX; i++) {
g_waveFormFuncU[i] = dcf;
g_phiU[i] = 0;
if (!g_active) {
g_phiU[i] = 0;
}
g_dphiU[i] = 0;
g_amplitudeU[i] = 0;
g_offsetU[i] = 0;

g_waveFormFuncI[i] = dcf;
g_phiI[i] = 0;
if (!g_active) {
g_phiI[i] = 0;
}
g_dphiI[i] = 0;
g_amplitudeI[i] = 0;
g_offsetI[i] = 0;
Expand Down Expand Up @@ -1553,8 +1559,11 @@ void reloadWaveformParameters() {
if (waveformParameters.resourceType == FUNCTION_GENERATOR_RESOURCE_TYPE_U) {
g_waveFormFuncU[channel->channelIndex] = getWaveformFunction(waveformParameters);
g_dutyCycleU[channel->channelIndex] = g_dutyCycle;
g_phiU[channel->channelIndex] = waveformParameters.phaseShift / 360.0f;
g_dphiU[channel->channelIndex] = 2.0f * M_PI_F * waveformParameters.frequency * PERIOD;
if (!g_active || g_phaseShiftU[i] != waveformParameters.phaseShift) {
g_phiU[channel->channelIndex] = 2.0 * M_PI * waveformParameters.phaseShift / 360.0f;
g_phaseShiftU[i] = waveformParameters.phaseShift;
}
g_dphiU[channel->channelIndex] = 2.0 * M_PI * waveformParameters.frequency * PERIOD;

if (waveformParameters.waveform == WAVEFORM_DC) {
g_amplitudeU[channel->channelIndex] = 0.0f;
Expand All @@ -1566,8 +1575,11 @@ void reloadWaveformParameters() {
} else {
g_waveFormFuncI[channel->channelIndex] = getWaveformFunction(waveformParameters);
g_dutyCycleI[channel->channelIndex] = g_dutyCycle;
g_phiI[channel->channelIndex] = waveformParameters.phaseShift / 360.0f;
g_dphiI[channel->channelIndex] = 2.0f * M_PI_F * waveformParameters.frequency * PERIOD;
if (!g_active || g_phaseShiftI[i] != waveformParameters.phaseShift) {
g_phiI[channel->channelIndex] = 2.0 * M_PI * waveformParameters.phaseShift / 360.0f;
g_phaseShiftI[i] = waveformParameters.phaseShift;
}
g_dphiI[channel->channelIndex] = 2.0 * M_PI * waveformParameters.frequency * PERIOD;

if (waveformParameters.waveform == WAVEFORM_DC) {
g_amplitudeI[channel->channelIndex] = 0.0f;
Expand Down Expand Up @@ -1622,7 +1634,7 @@ void tick() {
float value = g_offsetU[i] + g_amplitudeU[i] * g_waveFormFuncU[i](g_phiU[i]) / 2.0f;

g_phiU[i] += g_dphiU[i];
if (g_phiU[i] >= 2.0f * M_PI_F) {
while (g_phiU[i] >= 2.0f * M_PI_F) {
g_phiU[i] -= 2.0f * M_PI_F;
}

Expand Down
Loading

0 comments on commit 145a8e7

Please sign in to comment.