Добавлен плот не по массиву и экзампл для синуса

This commit is contained in:
2025-02-21 12:30:34 +03:00
parent d58273fe41
commit 9a4e3c3dad
5 changed files with 71 additions and 47 deletions

View File

@@ -2,8 +2,8 @@
#include "math.h"
int menu_white_theme = 0;
//#define SINE_EXAMPLE
#define ECG_EXAMPLE
#define SINE_EXAMPLE
//#define ECG_EXAMPLE
//#define PLAYER_EXAMPLE
@@ -84,15 +84,18 @@ void Example_OLED_GFX_Update(PlayerTypeDef *player)
oled_refresh();
}
}
float sine2plot;
float sine_cnt_step = 0.01;
int shift = 1;
float ecg_cnt = 0;
float ecg_cnt_step = 1;
float ecg_scale = 16;
float sine_cnt = 1;
void Example_GFX_CreateFrame(PlayerTypeDef *player)
{
#if defined(SINE_EXAMPLE) || defined(ECG_EXAMPLE)
GFX_Draw_Plotter(oled_buf, &plotter);
#if defined(SINE_EXAMPLE)
sine2plot = sinf(sine_cnt);
GFX_FloatPlotter(oled_buf, &plotter, &sine2plot);
sine_cnt += sine_cnt_step;
#elif defined(ECG_EXAMPLE)
GFX_FloatPlotter(oled_buf, &plotter, NULL);
#elif defined(PLAYER_EXAMPLE)
GFX_Clean_Buffer_Frame(oled_buf);
@@ -202,15 +205,14 @@ void Example_GFX_PlotterInit(void)
plotter.plotXAxis = 1;
plotter.plotYAxis = 1;
#if defined(SINE_EXAMPLE)
int pix_y = (int)((float)(sinf(sine_cnt)+shift)*((float)32/(1+shift)));
#if defined(SINE_EXAMPLE)
plotter.dataMax = 1.1;
plotter.signedData = 1;
#elif defined(ECG_EXAMPLE)
plotter.pDataPtr = ecg_data;
plotter.dataMax = 1.1;
plotter.dataSize = 550;
plotter.signedData = 1;
plotter.plotShift = 0;
plotter.plotSpeed = 2.5;
#endif