ERIS CORE

◆ render()

void FLASHMEM AppWren::render ( )
overrideprotectedvirtual

class specific update implementation

Reimplemented from AppBaseClass.

Definition at line 1572 of file AppWren.cpp.

1572  {
1573  if (enable_call_forwarding == false){ //if no script loaded
1574  return;
1575  } else{
1577  if(reboot_request){
1578  reboot_request = false;
1579  //handle the reboot request from the running wren script
1580  restartVM();
1582  enable_call_forwarding = false;
1583  restartVM();
1584  } else enable_call_forwarding = true;
1585  freeModuleSource();
1586  return;
1587  }
1588  wrenEnsureSlots(vm, 4);
1589  wrenSetSlotHandle(vm, 0, h_slot0);//App
1590  if (!isWrenResultOK(wrenCall(vm,h_render))){
1592  }else{
1593  if(is_pressed==false && show_active == true && time_active > SHOW_ACTIVE_TIME_MILLISEC){
1594  show_active = false;
1595  time_active = 0;
1596  }
1597  if(using_image){
1598  if(!surface_cache){
1599  //surface_cache = new Surface(am->p_fast_img_cache_surface, widget_width, widget_height);
1600  if(!dynamicSurfaceManager()){
1601  Serial.println(F("M AppWren::render() VM ERROR: Surface not available"));
1602  return;
1603  }else Serial.println(F("M AppWren::render() Surface created"));
1604  } else{
1605  if(has_pop || has_focus){
1606  //do nothing
1607  }else{
1609  }
1610  }
1611  }else{
1612  draw->fillRoundRect(x,y,w,h/2+3,3,am->data->read("UI_BUTTON_FILL_COLOR"));
1613  draw->fillRoundRect(x,y+h/2,w,h/2,3,am->data->read("UI_BUTTON_SHADE_COLOR"));
1614  }
1615  if(has_pop || has_focus){
1616  //do nothing
1617  }else{
1618  if (show_active){
1619  draw->drawRoundRect(x,y,w,h,4,am->data->read("UI_BUTTON_ACTIVE_BORDER_COLOR"));
1620  } else{
1621  draw->drawRoundRect(x,y,w,h,4,am->data->read("UI_BUTTON_INACTIVE_BORDER_COLOR"));
1622  }
1623 
1624  if(!using_image){
1625  draw->setTextColor(am->data->read("UI_BUTTON_TEXT_COLOR"));
1626  draw->setCursor(x+(w/2),y+(h/2),true);
1627  draw->setFont(Arial_9);
1628  //draw->print(text);
1629  }
1630  }
1631  }
1632  }
1633  am->data->update("VM_BYTES_ALLOCATED",(int32_t)wrenCollectGarbage(vm));
1634  draw->disablePixelOP();//disable pixel op and the end of the render cycle
1635  }; //called only when the app is active
const ILI9341_t3_font_t Arial_9
@ BLT_COPY
AppManager * am
Definition: AppBaseClass.h:38
ILI9341_t3_ERIS * draw
Definition: AppBaseClass.h:41
Surface * p_display_surface
Definition: AppManager.h:65
SvcDataDictionary * data
Definition: AppManager.h:63
const char * loadModuleSource(const char *name)
receiver for the wren c callback function getSourceForModule
Definition: AppWren.cpp:1690
char wren_module_name[MAX_TEXT_LENGTH]
Definition: AppWren.h:768
bool using_image
Definition: AppWren.h:773
Surface * surface_cache
Definition: AppWren.h:770
bool FASTRUN loadScript(const char *script)
runs the script in the VM
Definition: AppWren.h:152
bool dynamicSurfaceManager()
responsible for managing the surface buffer memory allocation
Definition: AppWren.cpp:1541
void releaseWrenHandles()
release any/all Wren embedded call handles
Definition: AppWren.cpp:1651
bool isWrenResultOK(WrenInterpretResult res)
Definition: AppWren.h:543
bool show_active
Definition: AppWren.h:776
bool reboot_request
Definition: AppWren.h:764
bool is_pressed
Definition: AppWren.h:772
bool enable_call_forwarding
Definition: AppWren.h:765
WrenHandle * h_render
Definition: AppWren.h:782
WrenVM * vm
Definition: AppWren.h:780
elapsedMillis time_active
Definition: AppWren.h:775
WrenHandle * h_slot0
Definition: AppWren.h:781
void freeModuleSource()
receiver for the wren c callback function loadModuleComplete indicating it's now ok to release the mo...
Definition: AppWren.cpp:1719
void FLASHMEM restartVM()
shutsdown then starts the VM
Definition: AppWren.h:125
void bltSurface2Surface(Surface *dest, int16_t dest_x, int16_t dest_y, Surface *source, int16_t from_x, int16_t from_y, int16_t from_width, int16_t from_height, bltMode blt_mode)
block transfer from source to dest with the given parameters
uint16_t getHeight()
uint16_t getWidth()
int32_t read(const char *key)
returns the int32_t value of the record
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 ...

References AppBaseClass::am, Arial_9, BLT_COPY, ILI9341_t3_ERIS::bltSurface2Surface(), AppManager::data, ILI9341_t3_ERIS::disablePixelOP(), AppBaseClass::draw, dynamicSurfaceManager(), enable_call_forwarding, freeModuleSource(), Surface::getHeight(), Surface::getWidth(), AppBaseClass::h, h_render, h_slot0, AppBaseClass::has_focus, AppBaseClass::has_pop, is_pressed, isWrenResultOK(), loadModuleSource(), loadScript(), AppManager::p_display_surface, SvcDataDictionary::read(), reboot_request, releaseWrenHandles(), restartVM(), show_active, surface_cache, time_active, SvcDataDictionary::update(), using_image, vm, AppBaseClass::w, wren_module_name, AppBaseClass::x, and AppBaseClass::y.

+ Here is the call graph for this function: