diff --git a/Core/Src/main.c b/Core/Src/main.c index a4ac7bf..9201045 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -634,7 +634,7 @@ static void MX_TIM1_Init(void) /* USER CODE END TIM1_Init 1 */ htim1.Instance = TIM1; - htim1.Init.Prescaler = 199; + htim1.Init.Prescaler = 19; htim1.Init.CounterMode = TIM_COUNTERMODE_UP; htim1.Init.Period = 99; htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; diff --git a/RealtimeOscilloscope.ioc b/RealtimeOscilloscope.ioc index ee8fc73..6a4548a 100644 --- a/RealtimeOscilloscope.ioc +++ b/RealtimeOscilloscope.ioc @@ -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.OCMode_1=TIM_OCMODE_TOGGLE TIM1.Period=99 -TIM1.Prescaler=199 +TIM1.Prescaler=19 TIM5.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 TIM5.IPParameters=Channel-PWM Generation4 CH4 USART1.IPParameters=VirtualMode-Asynchronous diff --git a/src/app/oscilloscopecontroller.cpp b/src/app/oscilloscopecontroller.cpp index 5d7512d..9b37745 100644 --- a/src/app/oscilloscopecontroller.cpp +++ b/src/app/oscilloscopecontroller.cpp @@ -111,15 +111,15 @@ void Controller::onCheckBoxTriggerCheckState(bool checked) void Controller::doShowAnalogSignal() { /* - * 460px for 8 div + * 640px for 8 div * fs = 100kHz => 100 samples/ms - * 500 us/div => 400 samples => scale = 400/460 = 0,870 - * 1 ms/div => 800 samples => scale = 800/460 = 1,739 - * 2 ms/div => 1600 samples => scale = 1600/460 = 3,478 - * 5 ms/div => 4000 samples => scale = 4000/460 = 8,696 - * 10 ms/div => 8000 samples => scale = 8000/460 = 17,391 + * 500 us/div => 400 samples => scale = 400/640 = 0,625 + * 1 ms/div => 800 samples => scale = 800/640 = 1,25 + * 2 ms/div => 1600 samples => scale = 1600/640 = 2,5 + * 5 ms/div => 4000 samples => scale = 4000/640 = 6,25 + * 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]; gui().drawGraphPoints(_adcValuesBuffer, _adcValuesBufferSize, scale); }