Stop using 50ms mixer period when no module enabled
Also adds a 2ms mixer period if internal and external modules are stopped but joystick mode is active
This commit is contained in:
committed by
Peter Feerick
parent
4258684248
commit
31cb282dd2
@@ -45,6 +45,11 @@ uint16_t getMixerSchedulerPeriod()
|
|||||||
if (mixerSchedules[EXTERNAL_MODULE].period) {
|
if (mixerSchedules[EXTERNAL_MODULE].period) {
|
||||||
return mixerSchedules[EXTERNAL_MODULE].period;
|
return mixerSchedules[EXTERNAL_MODULE].period;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(STM32) && !defined(SIMU)
|
||||||
|
if (getSelectedUsbMode() == USB_JOYSTICK_MODE) {
|
||||||
|
return MIXER_SCHEDULER_JOYSTICK_PERIOD_US;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return MIXER_SCHEDULER_DEFAULT_PERIOD_US;
|
return MIXER_SCHEDULER_DEFAULT_PERIOD_US;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
#ifndef _MIXER_SCHEDULER_H_
|
#ifndef _MIXER_SCHEDULER_H_
|
||||||
#define _MIXER_SCHEDULER_H_
|
#define _MIXER_SCHEDULER_H_
|
||||||
|
|
||||||
#define MIXER_SCHEDULER_DEFAULT_PERIOD_US 4000u // 4ms
|
#define MIXER_SCHEDULER_DEFAULT_PERIOD_US 4000u // 4ms
|
||||||
|
#define MIXER_SCHEDULER_JOYSTICK_PERIOD_US 2000u // 2ms
|
||||||
|
|
||||||
#define MIN_REFRESH_RATE 1750 /* us */
|
#define MIN_REFRESH_RATE 1750 /* us */
|
||||||
#define MAX_REFRESH_RATE 50000 /* us */
|
#define MAX_REFRESH_RATE 50000 /* us */
|
||||||
|
|||||||
@@ -327,8 +327,8 @@ void enablePulsesExternalModule(uint8_t protocol)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// external module stopped, set period to 50ms (necessary for USB Joystick, for instance)
|
// external module stopped, use default mixer period
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, 50000/*us*/);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ static void enablePulsesInternalModule(uint8_t protocol)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// internal module stopped, set internal period to 0 and start the scheduler
|
// internal module stopped, use default mixer period
|
||||||
mixerSchedulerSetPeriod(INTERNAL_MODULE, 0);
|
mixerSchedulerSetPeriod(INTERNAL_MODULE, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user