mixer_interrupt branch merged to trunk
timers on stock board should be more accurate
This commit is contained in:
+40
-2
@@ -150,7 +150,6 @@ bool listSDcardModels()
|
||||
FRESULT res = f_opendir(&dir, MODELS_PATH); /* Open the directory */
|
||||
if (res == FR_OK) {
|
||||
for (;;) {
|
||||
wdt_reset();
|
||||
res = f_readdir(&dir, &fno); /* Read a directory item */
|
||||
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
|
||||
if (fno.fname[0] == '.') continue; /* Ignore dot entry */
|
||||
@@ -1229,8 +1228,28 @@ bool reachExpoMixCountLimit(uint8_t expo)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(PCBV4)
|
||||
inline void pauseMixerCalculations()
|
||||
{
|
||||
cli();
|
||||
TIMSK5 &= ~(1<<OCIE5A);
|
||||
sei();
|
||||
}
|
||||
|
||||
inline void resumeMixerCalculations()
|
||||
{
|
||||
cli();
|
||||
TIMSK5 |= (1<<OCIE5A);
|
||||
sei();
|
||||
}
|
||||
#else
|
||||
#define pauseMixerCalculations()
|
||||
#define resumeMixerCalculations()
|
||||
#endif
|
||||
|
||||
void deleteExpoMix(uint8_t expo, uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
if (expo) {
|
||||
memmove(expoaddress(idx), expoaddress(idx+1), (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
memset(expoaddress(MAX_EXPOS-1), 0, sizeof(ExpoData));
|
||||
@@ -1239,12 +1258,14 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
|
||||
memmove(mixaddress(idx), mixaddress(idx+1), (MAX_MIXERS-(idx+1))*sizeof(MixData));
|
||||
memset(mixaddress(MAX_MIXERS-1), 0, sizeof(MixData));
|
||||
}
|
||||
resumeMixerCalculations();
|
||||
STORE_MODELVARS;
|
||||
}
|
||||
|
||||
static int8_t s_currCh;
|
||||
void insertExpoMix(uint8_t expo, uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
if (expo) {
|
||||
ExpoData *expo = expoaddress(idx);
|
||||
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
@@ -1261,11 +1282,13 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
|
||||
mix->srcRaw = (s_currCh > 4 ? s_currCh : channel_order(s_currCh));
|
||||
mix->weight = 100;
|
||||
}
|
||||
resumeMixerCalculations();
|
||||
STORE_MODELVARS;
|
||||
}
|
||||
|
||||
void copyExpoMix(uint8_t expo, uint8_t idx)
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
if (expo) {
|
||||
ExpoData *expo = expoaddress(idx);
|
||||
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
@@ -1274,6 +1297,7 @@ void copyExpoMix(uint8_t expo, uint8_t idx)
|
||||
MixData *mix = mixaddress(idx);
|
||||
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
|
||||
}
|
||||
resumeMixerCalculations();
|
||||
STORE_MODELVARS;
|
||||
}
|
||||
|
||||
@@ -1283,11 +1307,13 @@ void memswap(void *a, void *b, uint8_t size)
|
||||
uint8_t *y = (uint8_t*)b;
|
||||
uint8_t temp ;
|
||||
|
||||
pauseMixerCalculations();
|
||||
while (size--) {
|
||||
temp = *x;
|
||||
*x++ = *y;
|
||||
*y++ = temp;
|
||||
}
|
||||
resumeMixerCalculations();
|
||||
}
|
||||
|
||||
bool swapExpo(uint8_t &idx, uint8_t up)
|
||||
@@ -1923,7 +1949,9 @@ void menuProcLimits(uint8_t _event)
|
||||
if (event==EVT_KEY_LONG(KEY_MENU)) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
killEvents(event);
|
||||
pauseMixerCalculations();
|
||||
moveTrimsToOffsets(); // if highlighted and menu pressed - move trims to offsets
|
||||
resumeMixerCalculations();
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1961,11 +1989,21 @@ void menuProcLimits(uint8_t _event)
|
||||
lcd_outdezAtt( 8*FW, y, ld->offset, attr|PREC1);
|
||||
#endif
|
||||
if (active) {
|
||||
ld->offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL|NO_INCDEC_MARKS);
|
||||
int16_t new_offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL|NO_INCDEC_MARKS);
|
||||
#if defined(PCBV4)
|
||||
if (checkIncDec_Ret)
|
||||
#endif
|
||||
{
|
||||
pauseMixerCalculations();
|
||||
ld->offset = new_offset;
|
||||
resumeMixerCalculations();
|
||||
}
|
||||
}
|
||||
else if (attr && event==EVT_KEY_LONG(KEY_MENU)) {
|
||||
int16_t zero = g_chans512[k];
|
||||
pauseMixerCalculations();
|
||||
ld->offset = (ld->revert) ? -zero : zero;
|
||||
resumeMixerCalculations();
|
||||
s_editMode = 0;
|
||||
STORE_MODELVARS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user