Updating Button Text
Posted: Wed Dec 18, 2024 1:37 pm
Hello, I've been working with the GTT70A and have had success with updating labels on the touchscreen based on variables in a c-code. I found the GTT2.25 Manual, and followed the protocol for updating label text. I found success when sending:
send_byte(254, port); // Command prefix
send_byte(250, port); // Protocol-specific prefix
send_byte(1, port); // Command ID: Update Property
send_byte(10, port); // Property Command: Set Text
send_u16(label_id, port); // Send the Object ID (Label ID 2)
send_u16(0x0906, port); // Send the Property ID for text
send_byte(encoding, port); // Encoding: 1 for ASCII
send_u16(text_length + 1, port); // Send the Byte Length of the text (+1 for null terminator)
send_string(variable_string, port); // Send the variable string
send_byte(0, port); // Send the Null Terminator
I'm trying to do the same thing with Buttons now. I want to be able to update the text on buttons based on variables in my c code. I've set up my button text update function similar to how the label update function works. According to the GTT 2.5 protocol, the following should allow for button text updates, but I am not seeing any success in my testing. Is this the correct protocol for Raw Button (GTT2.5)? Is the "SET TEXT" property command different between the two? Am I perhaps looking in the wrong place, or executing this wrong?
send_byte(254, port); // Command prefix
send_byte(250, port); // Protocol-specific prefix
send_byte(1, port); // Command ID: Update Property
send_byte(10, port); // Property Command: Set Text
send_u16(button_id, port); // Send the Object ID (Button ID)
send_u16(0x0F03, port); // Property ID for Button Text Send the Property ID for text (specific to buttons)
send_byte(encoding, port); // Encoding: 1 for ASCII
send_u16(text_length + 1, port);// Send the Byte Length of the text (+1 for null terminator)
send_string(value_string, port);// Send the Value string
send_byte(0, port);// Send the Null Terminator
Thank you for your help!
send_byte(254, port); // Command prefix
send_byte(250, port); // Protocol-specific prefix
send_byte(1, port); // Command ID: Update Property
send_byte(10, port); // Property Command: Set Text
send_u16(label_id, port); // Send the Object ID (Label ID 2)
send_u16(0x0906, port); // Send the Property ID for text
send_byte(encoding, port); // Encoding: 1 for ASCII
send_u16(text_length + 1, port); // Send the Byte Length of the text (+1 for null terminator)
send_string(variable_string, port); // Send the variable string
send_byte(0, port); // Send the Null Terminator
I'm trying to do the same thing with Buttons now. I want to be able to update the text on buttons based on variables in my c code. I've set up my button text update function similar to how the label update function works. According to the GTT 2.5 protocol, the following should allow for button text updates, but I am not seeing any success in my testing. Is this the correct protocol for Raw Button (GTT2.5)? Is the "SET TEXT" property command different between the two? Am I perhaps looking in the wrong place, or executing this wrong?
send_byte(254, port); // Command prefix
send_byte(250, port); // Protocol-specific prefix
send_byte(1, port); // Command ID: Update Property
send_byte(10, port); // Property Command: Set Text
send_u16(button_id, port); // Send the Object ID (Button ID)
send_u16(0x0F03, port); // Property ID for Button Text Send the Property ID for text (specific to buttons)
send_byte(encoding, port); // Encoding: 1 for ASCII
send_u16(text_length + 1, port);// Send the Byte Length of the text (+1 for null terminator)
send_string(value_string, port);// Send the Value string
send_byte(0, port);// Send the Null Terminator
Thank you for your help!