2024-06-10 11:52 PM
Hello,
I am trying to make a wifi list using STM32H750B-DK. I designed my screen and add scroll list in it. I am receiving the wifi list from the esp32 and I want to show them on my list. I manage the copy it in my container but I got an issue. When I tried to invalidate it, it is not showing the wifi's until I scroll it down or up. Does anybody have an idea?
void WiFiScreenView::wifiSSIDListUpdateItem(wifiSSIDContainer& item, int16_t itemIndex)
{
if(isWiFiListReceived){
item.refreshWiFi(itemIndex);
}
wifiSSIDList.invalidate();
}
Here is my update item code and wifiSSIDList is my scroll list not the container. And this is my container code.
void wifiSSIDContainer::refreshWiFi(uint8_t idx)
{
const char* wifiName = WiFiList[idx];
Unicode::strncpy(textWiFiNameBuffer, wifiName,TEXTWIFINAME_SIZE);
textWiFiName.setWildcard(textWiFiNameBuffer);
textWiFiName.invalidate();
}
If anybody have an idea I am open to try it.
Solved! Go to Solution.
2024-06-19 12:47 AM - edited 2024-06-19 12:51 AM
The wifiSSIDListUpdateItem(...)-callback is only called when:
If you don't know what changed (number of Wifis or their names or their order in your list), you can force an update to all items in your ScrollList by calling:
wifiSSIDList.setNumberOfItems(wifiCount);
for (int i = 0; i < wifiSSIDList.getNumberOfItems(); i++) {
wifiSSIDList.itemChanged(i);
}
wifiSSIDList.invalidate();
See solution of this thread for some insight into index to DrawableItem vs. "WifiSSIDListIndex": https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-simulator-assertion-quot-timerwidget-registered-too/td-p/679316
2024-06-11 05:26 AM
Hello @Aurentiaco ,
I assume your list is in the screen named WiFiScreen.
In the file WiFiScreenView.cpp, did you add anything in the initialize function?
I think that you should call something in it like for instance your wifiSSIDListUpdateItem function.
Regards,
2024-06-11 05:44 AM
Hello @hellohello
This is my code there isn't any initialization function or code when I check the .hpp files.
WiFiScreenView::WiFiScreenView() :
wifiSSIDList_ItemSelectedCallback(this, &WiFiScreenView::wifiSSIDList_ItemSelectedHandler)
{
keyboard.setPosition(80,16,320,240);
add(keyboard);
keyboard.setVisible(false);
keyboard.invalidate();
}
void WiFiScreenView::setupScreen()
{
wifiSSIDList.setItemSelectedCallback(wifiSSIDList_ItemSelectedCallback);
WiFiScreenViewBase::setupScreen();
buttonBack.setVisible(true);
buttonBack.invalidate();
buttonRefresh.setVisible(true);
buttonRefresh.invalidate();
MQTT_TX("$WSRC","page/tanksetupadc", "JSON");
}
void WiFiScreenView::tearDownScreen()
{
WiFiScreenViewBase::tearDownScreen();
}
void WiFiScreenView::RuntimeCheck()
{
if(sleepCounter > 300 && powerSetting5minSelected){
gotoSleepScreen();
}
if(connectedWifiFlag){
wifiConnected.setVisible(true);
wifiConnected.invalidate();
}
else{
wifiConnected.setVisible(false);
wifiConnected.invalidate();
}
}
void WiFiScreenView::wifiSSIDListUpdateItem(wifiSSIDContainer& item, int16_t itemIndex)
{
if(isWiFiListReceived){
item.refreshWiFi(itemIndex);
}
wifiSSIDList.invalidate();
}
What do you suggest? This is my WiFiScreenView.cpp
2024-06-11 07:01 AM
Yes, I forgot the name. I meant to say setupScreen().
Can you try to invalidate it in your setupScreen (doubt it would work but worth the try).
Can you try to scroll using the code (not actually touching the screen) with either
virtual void animateToPosition(int32_t position, int16_t steps =-1)
//Animate to a new position/offset using the given number of steps.
or
virtual void animateToItem(int16_t itemIndex, int16_t animationSteps =-1)
//Go to a specific item, possibly with animation.
2024-06-19 12:47 AM - edited 2024-06-19 12:51 AM
The wifiSSIDListUpdateItem(...)-callback is only called when:
If you don't know what changed (number of Wifis or their names or their order in your list), you can force an update to all items in your ScrollList by calling:
wifiSSIDList.setNumberOfItems(wifiCount);
for (int i = 0; i < wifiSSIDList.getNumberOfItems(); i++) {
wifiSSIDList.itemChanged(i);
}
wifiSSIDList.invalidate();
See solution of this thread for some insight into index to DrawableItem vs. "WifiSSIDListIndex": https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-simulator-assertion-quot-timerwidget-registered-too/td-p/679316
2024-08-06 06:10 AM
@t.decker Thank you for your advice I tried it and it works fine.