Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Fitness Equipment → Thread

   

Setting target power on bike trainer

Rank

Total Posts: 2

Joined 2020-05-11

PM

I am developing my first ANT+ app as a personal project. I'm using a Tacx Flux Smart 2 for testing purposes. Right now all the basic setup is done and I am receiving all the required broadcast-type pages (25, 16, 80, 81, and manufacturer-specific). I can read all parameters like speed, cadence, etc...

What I'm currently struggling with is setting the target power (page 49). Per the documentation's instructions, I am sending my target power as an acknowledged message as follows:
var msg = new byte[8]{0x310xFF0xFF0xFF0xFF0xFF2400};
var 
response antMgr.deviceList[0].connectedChannel.sendAcknowledgedData(msg500); 

A
MessagingReturnCodepass 
is returned, and in my main callback function I receive a response with
responseIDRESPONSE_EVENT_0x40 
and in the last (third) byte of messageContents
EventIDEVENT_TRANSFER_TX_COMPLETED_0x05 
indicating, if I understand correctly, that the message has been successfully received by the device.

However, even though I get the same confirmation and a pass response when I send the following request for page 70 (request date page):
var responseCommandStatus antMgr.deviceList[0].connectedChannel.sendAcknowledgedData(new byte[1] {70}500); 

I do not receive status page 71, only a response event indicating successful TX, as above, and then all the required pages (listed above) periodically, as per normal.

It is worth noting that the trainer is indicating that a resistance calibration is required (in page 25, last 4 bits of byte 6), but I am assuming this would interfere only with setting the target power appropriately, not with requesting status (page 71). I just want to make sure I am able to read the status before I delve into the calibration process.

Am I doing something incorrectly? If not, any idea what might be going wrong?

Thanks in advance.

EDIT: I just tested whether or not the power is successfully set by pedaling. I tested with extreme values just to be certain, and the bike trainer is definitely setting power the values I sent. For obvious reasons, I still would like to be able to receive and interpret page 71.      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

When you send page 70, you must send an 8 byte page formatted as defined in the document "ANT+ Common Pages" section 6.2. It looks like you are only sending a 1 byte array into sendAcknowledgedData, which may cause it to ignore the input since this is not a valid input for an ant acknowledged data message or may cause junk data for the remainder of the bytes.

Format should be including the page number requested (71), as a broadcast page, and usually request more than once response in case there are rf issues.

     

Signature

Ian Haigh

Rank

Total Posts: 2

Joined 2020-05-11

PM

I hadn't noticed this document before. The message format was indeed the problem. Everything is working fine now. Thank you.

EDIT: This is the message format I used for the request that worked:
var ackResponse myConnectedChannel.sendAcknowledgedData(
                    new 
byte[8] { 700xFF0xFF0xFF0xFF3711 }500); 


haighi - 19 October 2020 11:26 AM
When you send page 70, you must send an 8 byte page formatted as defined in the document "ANT+ Common Pages" section 6.2. It looks like you are only sending a 1 byte array into sendAcknowledgedData, which may cause it to ignore the input since this is not a valid input for an ant acknowledged data message or may cause junk data for the remainder of the bytes.

Format should be including the page number requested (71), as a broadcast page, and usually request more than once response in case there are rf issues.

     
Rank

Total Posts: 4

Joined 2019-05-16

PM

i have successfully sent my Target Power on 0x31 page, how to stop Power Mode ?
in Bluetooth FTMS, there are OP codes to stop, reset controllable settings.
how to achieve in ANT+ ?      
RankRankRankRank

Total Posts: 370

Joined 2012-06-27

PM

You need to send a control page that configures the new mode you wish the FE to be in. See section 6.4 of the profile document for the options.      

Signature

Ian Haigh