ERIS CORE

◆ render()

void AppScope::render ( )
inlineprotectedvirtual

render loop

Reimplemented from AppBaseClass.

Definition at line 30 of file appScope.h.

30  {
31 
32  uint16_t y_last_scope;
33  uint16_t y_last_scope_ch2;
34 
35  y_last_scope=h/2;
36  y_last_scope_ch2=h/2;
37 
38  scale = 30000.0 / ((float)scope->getPeakValue() + 0.0001);
39  if (scale > 10.0) scale = 10.0;
40  am->data->update("OSCOPE_SCALE",scale);
41  if (has_pop) draw->fillRoundRect(x,y,w,h,3,CL(0,0,0));
42  for (int16_t i=0;i<w;i++){
43  int16_t v;
44  float f;
45  uint16_t ch1,ch2;
46  v = scope->read(0,i) * scale;
47  f = ((v * 0.000030517578125) + 1.0) * 0.5; // 1/32768 = 0.000030517578125
48  ch1 = y + (uint16_t)(f * h);
49  if (i > 0) draw->drawLine(x + i-1,y_last_scope,x + i,ch1,ILI9341_ORANGE);
50  //draw the second channel
51  v = scope->read(1,i) * scale;
52  f = ((v * 0.000030517578125) + 1.0) * 0.5;
53  ch2 = y + (uint16_t)(f * h);
54  if (i > 0) draw->drawLine(x + i-1,y_last_scope_ch2,x + i,ch2,ILI9341_GREEN);
55  //draw x-y plot
56  if (i > 0) draw->drawLine(y_last_scope_ch2,y_last_scope,ch2,ch1,ILI9341_GREENYELLOW);
57  y_last_scope = ch1;
58  y_last_scope_ch2 = ch2;
59  }
60 
61  if (w>120 && h>60){
62  draw->setCursor(x+w - 100,y+5);
63  draw->print("scale: ");
64  draw->print(scale);
65  draw->setCursor(x+w - 100,y+20);
66  draw->print("hdiv: ");
67  draw->print(scope->getHDiv());
68  }
69  draw->drawRoundRect(x,y,w,h,4,ILI9341_MAGENTA);
70  }; //called only when the app is active
AppManager * am
Definition: AppBaseClass.h:38
ILI9341_t3_ERIS * draw
Definition: AppBaseClass.h:41
SvcDataDictionary * data
Definition: AppManager.h:63
erisAudioAnalyzeScope * scope
Definition: appScope.h:25
float32_t scale
Definition: appScope.h:29
bool update(const char *key, int32_t val, uint32_t *owner)
update the value of an owned record creates a new record if one does not exist and initializes its ...
int16_t read(int8_t channel, uint16_t mem_index)

References AppBaseClass::am, AppManager::data, AppBaseClass::draw, erisAudioAnalyzeScope::getHDiv(), erisAudioAnalyzeScope::getPeakValue(), AppBaseClass::h, AppBaseClass::has_pop, erisAudioAnalyzeScope::read(), scale, scope, SvcDataDictionary::update(), AppBaseClass::w, AppBaseClass::x, and AppBaseClass::y.

+ Here is the call graph for this function: