cancel
Showing results for 
Search instead for 
Did you mean: 

Gauge Image only half appearing on screen, it simulates ok on ToughGFX designer and also with visual studio.

BO Re.1
Associate II

0690X00000D9vIlQAJ.jpg

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;
}

8 REPLIES 8
Martin KJELDSEN
Chief III

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

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

#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

I already had the canvas buffer un-commented it in main.cpp ,

i should have made it clearer in my original post that i had this step done

Barry

BO Re.1
Associate II

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

0690X00000DBqOnQAL.png

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

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

0690X00000DBrrWQAT.png0690X00000DBrrlQAD.png