1
0

fix fs @100kHz

This commit is contained in:
Rémi Heredero 2024-01-16 16:17:59 +01:00
parent e0ea7d4cc2
commit 58e7081738
3 changed files with 9 additions and 9 deletions

View File

@ -634,7 +634,7 @@ static void MX_TIM1_Init(void)
/* USER CODE END TIM1_Init 1 */ /* USER CODE END TIM1_Init 1 */
htim1.Instance = TIM1; htim1.Instance = TIM1;
htim1.Init.Prescaler = 199; htim1.Init.Prescaler = 19;
htim1.Init.CounterMode = TIM_COUNTERMODE_UP; htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
htim1.Init.Period = 99; htim1.Init.Period = 99;
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;

View File

@ -1223,7 +1223,7 @@ TIM1.Channel-Output\ Compare1\ No\ Output=TIM_CHANNEL_1
TIM1.IPParameters=Prescaler,Period,Channel-Output Compare1 No Output,OCMode_1 TIM1.IPParameters=Prescaler,Period,Channel-Output Compare1 No Output,OCMode_1
TIM1.OCMode_1=TIM_OCMODE_TOGGLE TIM1.OCMode_1=TIM_OCMODE_TOGGLE
TIM1.Period=99 TIM1.Period=99
TIM1.Prescaler=199 TIM1.Prescaler=19
TIM5.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 TIM5.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
TIM5.IPParameters=Channel-PWM Generation4 CH4 TIM5.IPParameters=Channel-PWM Generation4 CH4
USART1.IPParameters=VirtualMode-Asynchronous USART1.IPParameters=VirtualMode-Asynchronous

View File

@ -111,15 +111,15 @@ void Controller::onCheckBoxTriggerCheckState(bool checked)
void Controller::doShowAnalogSignal() { void Controller::doShowAnalogSignal() {
/* /*
* 460px for 8 div * 640px for 8 div
* fs = 100kHz => 100 samples/ms * fs = 100kHz => 100 samples/ms
* 500 us/div => 400 samples => scale = 400/460 = 0,870 * 500 us/div => 400 samples => scale = 400/640 = 0,625
* 1 ms/div => 800 samples => scale = 800/460 = 1,739 * 1 ms/div => 800 samples => scale = 800/640 = 1,25
* 2 ms/div => 1600 samples => scale = 1600/460 = 3,478 * 2 ms/div => 1600 samples => scale = 1600/640 = 2,5
* 5 ms/div => 4000 samples => scale = 4000/460 = 8,696 * 5 ms/div => 4000 samples => scale = 4000/640 = 6,25
* 10 ms/div => 8000 samples => scale = 8000/460 = 17,391 * 10 ms/div => 8000 samples => scale = 8000/640 = 12,5
*/ */
static float scales[7] = {0.87,0.87,1.739,3.478,8.696,17.391,17.391}; static float scales[7] = {0.625, 0.625, 1.25, 2.5, 6.25, 12.5, 12.5}; // tab for 100kHz
float scale = scales[this->_tdivValue]; float scale = scales[this->_tdivValue];
gui().drawGraphPoints(_adcValuesBuffer, _adcValuesBufferSize, scale); gui().drawGraphPoints(_adcValuesBuffer, _adcValuesBufferSize, scale);
} }