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:
@@ -264,8 +264,6 @@ extern char statusLineMsg[STATUS_LINE_LENGTH];
|
||||
void showStatusLine();
|
||||
void drawStatusLine();
|
||||
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(event_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
void pushModelNotes();
|
||||
@@ -273,8 +271,6 @@ void readModelNotes();
|
||||
|
||||
void menuChannelsView(event_t event);
|
||||
|
||||
#define LABEL(...) (uint8_t)-1
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
#define CURSOR_MOVED_LEFT(event) (event==EVT_ROTARY_LEFT)
|
||||
#define CURSOR_MOVED_RIGHT(event) (event==EVT_ROTARY_RIGHT)
|
||||
|
||||
@@ -24,46 +24,45 @@ extern uint8_t g_moduleIdx;
|
||||
|
||||
void menuModelFailsafe(event_t event)
|
||||
{
|
||||
static uint8_t maxNameLen = 4;
|
||||
static int8_t lastModel = g_eeGeneral.currModel;
|
||||
const coord_t barH = (LCD_H - FH) / 8 - 1;
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
uint8_t cols = 1;
|
||||
uint8_t colW = LCD_W;
|
||||
|
||||
if (lastModel != g_eeGeneral.currModel) {
|
||||
lastModel = g_eeGeneral.currModel;
|
||||
maxNameLen = 4;
|
||||
}
|
||||
switch(event) {
|
||||
case EVT_ENTRY:
|
||||
reusableBuffer.modelFailsafe.maxNameLen = 4;
|
||||
break;
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
|
||||
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
|
||||
if (s_editMode) {
|
||||
g_model.failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
s_editMode = 0;
|
||||
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
|
||||
if (s_editMode) {
|
||||
g_model.failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
int16_t * failsafe = &g_model.failsafeChannels[menuVerticalPosition];
|
||||
if (*failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
*failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (*failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
*failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
*failsafe = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int16_t * failsafe = &g_model.failsafeChannels[menuVerticalPosition];
|
||||
if (*failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
*failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (*failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
*failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
*failsafe = 0;
|
||||
// "Outputs => Failsafe" menu item
|
||||
setCustomFailsafe(g_moduleIdx);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// "Outputs => Failsafe" menu item
|
||||
setCustomFailsafe(g_moduleIdx);
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
break;
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx) + 1);
|
||||
@@ -95,7 +94,7 @@ void menuModelFailsafe(event_t event)
|
||||
const int32_t channelValue = channelOutputs[ch+channelStart];
|
||||
int32_t failsafeValue = g_model.failsafeChannels[8*col+line];
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch+channelStart].name);
|
||||
uint8_t barW = colW - FW * maxNameLen - FWNUM * 3; // default bar width
|
||||
uint8_t barW = colW - FW * reusableBuffer.modelFailsafe.maxNameLen - FWNUM * 3; // default bar width
|
||||
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
barW -= FWNUM + 1;
|
||||
@@ -104,8 +103,8 @@ void menuModelFailsafe(event_t event)
|
||||
|
||||
// Channel name if present, number if not
|
||||
if (lenLabel > 0) {
|
||||
if (lenLabel > maxNameLen)
|
||||
maxNameLen = lenLabel;
|
||||
if (lenLabel > reusableBuffer.modelFailsafe.maxNameLen)
|
||||
reusableBuffer.modelFailsafe.maxNameLen = lenLabel;
|
||||
lcdDrawSizedText(x - colW, y, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR | SMLSIZE);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user