Bsongis/ram saving (#6685)

RAM saving. Stacks reduced to have some more RAM available than 2.2 on all boards
This commit is contained in:
Bertrand Songis
2019-08-30 15:46:57 +02:00
committed by GitHub
parent ff2cde85be
commit 2d4e98d15d
28 changed files with 271 additions and 330 deletions
+15 -13
View File
@@ -22,44 +22,46 @@
void menuChannelsView(event_t event)
{
static bool longNames = false;
static bool secondPage = false;
static bool mixersView = false;
uint8_t ch = 0;
uint8_t wbar = (longNames ? 54 : 64);
uint8_t wbar = (reusableBuffer.viewChannels.longNames ? 54 : 64);
int16_t limits = 512 * 2;
#if defined(PPM_UNIT_PERCENT_PREC1)
wbar -= 6;
#endif
switch(event)
{
switch(event) {
case EVT_ENTRY:
memclear(&reusableBuffer.viewChannels, sizeof(reusableBuffer.viewChannels));
break;
case EVT_KEY_BREAK(KEY_EXIT):
popMenu();
break;
case EVT_KEY_FIRST(KEY_RIGHT):
case EVT_KEY_FIRST(KEY_LEFT):
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_LEFT:
case EVT_ROTARY_RIGHT:
#endif
secondPage = !secondPage;
reusableBuffer.viewChannels.secondPage = !reusableBuffer.viewChannels.secondPage;
break;
case EVT_KEY_FIRST(KEY_ENTER):
mixersView = !mixersView;
reusableBuffer.viewChannels.mixersView = !reusableBuffer.viewChannels.mixersView;
break;
}
if (secondPage)
if (reusableBuffer.viewChannels.secondPage)
ch = 16;
if (mixersView)
if (reusableBuffer.viewChannels.mixersView)
limits *= 2; // this could be handled nicer, but slower, by checking actual range for this mixer
else if (g_model.extendedLimits)
limits *= LIMIT_EXT_PERCENT / 100;
if (mixersView)
if (reusableBuffer.viewChannels.mixersView)
lcdDrawTextAlignedCenter(0, TR_MIXERS_MONITOR);
else
lcdDrawTextAlignedCenter(0, TR_CHANNELS_MONITOR);
@@ -76,13 +78,13 @@ void menuChannelsView(event_t event)
// Channels
for (uint8_t line=0; line < 8; line++) {
const uint8_t y = 9 + line * 7;
const int32_t val = mixersView ? ex_chans[ch] : channelOutputs[ch];
const int32_t val = reusableBuffer.viewChannels.mixersView ? ex_chans[ch] : channelOutputs[ch];
const uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
// Channel name if present, number if not
if (lenLabel > 0) {
if (lenLabel > 4)
longNames = true;
reusableBuffer.viewChannels.longNames = true;
lcdDrawSizedText(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE);
}
else {