2020-02-12 04:06 PM
i have use example from TouchGFX Demo 1, ive gone through code but cant see anything obvious. with the 746 Disco board, above.
i set up the project through TouchGFX designer, only one screen and copied code from example, here is the view.cpp
i have canvas buffer set at 3600, and tried increasing by 1000. but no difference. iI dont have much experience , (student) so any pointers /advice would be appreciated.
i have tried to search forum/google/documentation etc but had no luck as yet.
thanks in advance
Barry
#include <gui/screen1_screen/Screen1View.hpp>
#include "BitmapDatabase.hpp"
#include <texts/TextKeysAndLanguages.hpp>
#include <touchgfx/Color.hpp>
#include <touchgfx/EasingEquations.hpp>
Screen1View::Screen1View(): currentAnimationState(ANIMATION_GAUGE),
tickCounter(0)
{
}
void Screen1View::setupScreen()
{
gauge.setBitmaps(Bitmap(BITMAP_GAUGE_BACKGROUND_CURRENT_ID), Bitmap(BITMAP_GAUGE_NEEDLE_PIN_ID));
gauge.setXY(image1.getX() + (image1.getWidth() - gauge.getWidth())/2 , image1.getY() + (image1.getHeight() - gauge.getHeight()) / 2);
gauge.setLimits(0, 60, 240, 480);
gauge.setValue(40);
gauge.setAnimationDuration(20);
//gauge.setVisible(false);
add(gauge);
//gauge.invalidate();
gauge.setVisible(true);
gauge.invalidate();
currentAnimationState = NO_ANIMATION;
/*gauge.setVisible(true);
gauge.invalidate();*/
/*if (gauge.isVisible())
{
currentAnimationState = ANIMATION_GAUGE;
}*/
//Screen1ViewBase::setupScreen();
}
void Screen1View::tearDownScreen()
{
Screen1ViewBase::tearDownScreen();
}
void Screen1View::handleTickEvent()
{
tickCounter++;
/*gauge.setVisible(true);
gauge.invalidate();*/
if (gauge.isVisible())
{
currentAnimationState = ANIMATION_GAUGE;
}
if (getAnimationState() == ANIMATION_GAUGE)
{
if (tickCounter % 60 == 0)
{
if (gauge.getValue() > 50)
{
gauge.setEasingEquation(EasingEquations::backEaseOut);
gauge.setAnimationDuration(20);
gauge.setValue(0);
}
else
{
int value = gauge.getValue();
int newValue = value + 15;// Utils::randomNumberBetween(-6, 18);
if (newValue < value)
{
gauge.setEasingEquation(EasingEquations::backEaseOut);
gauge.setAnimationDuration((newValue - value) * 2);
}
else
{
gauge.setEasingEquation(EasingEquations::quadEaseOut);
gauge.setAnimationDuration(newValue - value);
}
gauge.setValue(newValue);
}
}
}
}
Screen1View::AnimationState Screen1View::getAnimationState()
{
/*if (currentAnimationState == ANIMATION_THREE_WAY_RUNNING)
{
for (int i = 0; i < NUMBER_OF_BARS; i++)
{
if (barAnimationState[i] == ANIMATION_THREE_WAY_RUNNING)
{
return ANIMATION_THREE_WAY_RUNNING;
}
}
return NO_ANIMATION;
}
*/
return currentAnimationState;
}
2020-02-17 01:43 AM
Do you know if the application is actually running on target? It looks like it might have crashed at the point where it needs to draw the needle (which requires an additional buffer to draw in).
/Martin
2020-02-17 05:38 AM
Hi Martin,
thanks for answering my query. the application is not running on target , i have tried with addition screens and if i press a button, which should then enter the gauge screen, but it just freezes and button becomes unresponsive, it must be additional buffer required for the needle, which stops the screen from rendering.
how/where would i create this buffer, in the bitmap file ?
thanks
Barry
2020-02-17 06:08 AM
#include <touchgfx/canvas_widget_renderer/CanvasWidgetRenderer.hpp>
#define CANVAS_BUFFER_SIZE (3600)
...
static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
touchgfx::CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);
/Martin
2020-02-17 07:12 AM
I already had the canvas buffer un-commented it in main.cpp ,
2020-02-17 07:34 AM
i should have made it clearer in my original post that i had this step done
Barry
2020-02-18 04:27 PM
Finally got it working in designer (thanks for your help), but when i try and add RTOS communication from main.c file it wont download to board correctly, so i tried to do it the 'hard way', and everything complies ok, QUADSPI is set up fine but when i add the external loader (N25Q128A) in the debug configuration, when i ttry and debug it fails to initialise external memory, i have checked the linker file to ensure correct address and this seems fine,
any ideas on this error.. i reinstalled st link hoping this might help but no joy
regards
Barry
2020-02-19 12:49 AM
I think you have to configure the flashloader from your debug configuration. You can "scan" and select the right one for your ST display kit.
/Martin
2020-02-19 01:56 AM
hey Martin,
i have configured the flashloader for my board 746g disco, pics below. i can flash the board if i disable the external loader but everything is saved to external memory so ! i started a new project just to do one step at a time and the same issue this morning?
Barry