cancel
Showing results for 
Search instead for 
Did you mean: 

Toggle Button Force State / Invalidate work for one function call but not another.

LBend.1
Associate III

I'm using an event to update indication statuses in my screen. There are four independent events that update the screen in the same fashion (with different images toggling for active/inactive). I added in another indication to show that when any of the events are registered it would indicate the 'global' status as well as the individual statuses.

The individual statuses all indicate properly, and debugging shows the program is reaching every one successfully. However, in my global status, only the fourth event (zone4heatcallstatus) indicates the global indication.

The code is identical (except numbers) for all. Any idea why this could be happening?

void MainMenuView::setHeatCallTextStatus(uint8_t status)
{
	if(status == 0)
	{
		textHeatCall_Active.setVisible(false);
		textHeatCall_Inactive.setVisible(true);
		textHeatCall_Active.invalidate();
		textHeatCall_Inactive.invalidate();
	}
	else
	{
		textHeatCall_Active.setVisible(true);
		textHeatCall_Inactive.setVisible(false);
		textHeatCall_Active.invalidate();
		textHeatCall_Inactive.invalidate();
	}
}

Thanks!

void MainMenuView::setZone1HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone1Thermostat.forceState(false);
		toggleZone1Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
	else
	{
		toggleZone1Thermostat.forceState(true);
		toggleZone1Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
}
void MainMenuView::setZone2HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone2Thermostat.forceState(false);
		toggleZone2Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
	else
	{
		toggleZone2Thermostat.forceState(true);
		toggleZone2Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
}
void MainMenuView::setZone3HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone3Thermostat.forceState(false);
		toggleZone3Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
	else
	{
		toggleZone3Thermostat.forceState(true);
		toggleZone3Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
}
void MainMenuView::setZone4HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone4Thermostat.forceState(false);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
	else
	{
		toggleZone4Thermostat.forceState(true);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
}

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

Just a guess since I don't know how you coded the rest but could it be that when you have another zone that the 4th on it turns the toggleHeatCall(true) but that it is then forced to false again since you have setZone4HeatCallStatus() called with a status 0 afterwards ? Could you try to fake a zone 3 heat active and put a printf in the two following functions ?

void MainMenuView::setZone3HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone3Thermostat.forceState(false);
		toggleZone3Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
	else
	{
		toggleZone3Thermostat.forceState(true);
		toggleZone3Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
               
               touchgfxprintf("Is the zone 3 called first ?");
	}
}
void MainMenuView::setZone4HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone4Thermostat.forceState(false);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
 
               touchgfxprintf("Or is it the zone 4 called first ?");
	}
	else
	{
		toggleZone4Thermostat.forceState(true);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
}

/Romain

View solution in original post

6 REPLIES 6
Alexandre RENOUX
Principal

Hello LBend.1,

Could you provide an image of your UI to have a better understanding of what you are doing ?

Is the issue happening both on your board and on the simulator ?

/Alexandre

LBend.1
Associate III

Hi Alexandre,

See the following images. I have external interrupts which cause each of the zones to illuminate with respect to which interrupt was activated. Both of the screenshots are part of the same screen, just within a swipe container. For each interrupt the respective zones (1-4) properly illuminate in the first image. What is also supposed to happen in the second image on any of the interrupts driven is that the 'global' heat call active/inactive is supposed to illuminate as well.

0693W00000BZmh7QAD.png0693W00000BZmhMQAT.png 

What I can't figure out is why it only does it for zone 4 in the following code. I've debugged and each of the setZone4HeatCallStatus(uint8_t status) breakpoints are reached (as also evidenced by the state changes of the toggle buttons/images in the first image.

void MainMenuView::setZone4HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone4Thermostat.forceState(false);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
	else
	{
		toggleZone4Thermostat.forceState(true);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
}

I am experiencing this issue in both my board and the simulator.

Thanks!

Hi Alexandre, 

See the following images. I have external interrupts which cause each of the zones to illuminate with respect to which interrupt was activated. Both of the screenshots are part of the same screen, just within a swipe container. For each interrupt the respective zones (1-4) properly illuminate in the first image. What is also supposed to happen in the second image on any of the interrupts driven is that the 'global' heat call active/inactive is supposed to illuminate as well.

0693W00000BZmh7QAD.png0693W00000BZmhMQAT.png 

What I can't figure out is why it only does it for zone 4 in the following code. I've debugged and each of the setZone4HeatCallStatus(uint8_t status) breakpoints are reached (as also evidenced by the state changes of the toggle buttons/images in the first image.

void MainMenuView::setZone4HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone4Thermostat.forceState(false);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
	else
	{
		toggleZone4Thermostat.forceState(true);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
}

I am experiencing this issue in both my board and the simulator. 

Thanks!

Hi,

Just a guess since I don't know how you coded the rest but could it be that when you have another zone that the 4th on it turns the toggleHeatCall(true) but that it is then forced to false again since you have setZone4HeatCallStatus() called with a status 0 afterwards ? Could you try to fake a zone 3 heat active and put a printf in the two following functions ?

void MainMenuView::setZone3HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone3Thermostat.forceState(false);
		toggleZone3Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
	else
	{
		toggleZone3Thermostat.forceState(true);
		toggleZone3Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
               
               touchgfxprintf("Is the zone 3 called first ?");
	}
}
void MainMenuView::setZone4HeatCallStatus(uint8_t status)
{
	if(status==0)
	{
		toggleZone4Thermostat.forceState(false);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(false);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
 
               touchgfxprintf("Or is it the zone 4 called first ?");
	}
	else
	{
		toggleZone4Thermostat.forceState(true);
		toggleZone4Thermostat.invalidate();
		toggleHeatCall.forceState(true);
		toggleHeatCall.invalidate();
		setHeatCallTextStatus(status);
	}
}

/Romain

Hi Romain,

That is exactly what is happening, I have the updates for all four zones coming together and updated together so the global status was always reset by another zone call. Only when zone4 is active is the status not getting reset to 0 as it's the last to update.

I just needed to added a state variable for each zone and update accordingly.

Thanks!

Good to hear it works now 👍

/Romain