You are here: Forum Home → ANT+ Forums → ANT+ Fitness Equipment → Thread
——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com
——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com
——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com
void Hub::setLoad(int antID, bool fecTrainer, double load) {
if (hashSensorFecNear.contains(antID)) {
qDebug() << "HUB#" << stickNumber << "ok this sensor is close, send Load to it!" << antID;
//return true if channel already openned, if not openned ask for permission to open
bool readyForSendingData = checkToOpenChannelFEC(antID);
if (readyForSendingData) {
//Get the channel of this device (1..7)
int channelNumber = hashSendingChannel.value(antID);
uint8_t aucTxBuf[ANT_STANDARD_DATA_PAYLOAD_SIZE];
FEC_Controller::EncodeTrainerTargetPower(aucTxBuf, load);
pclMessageObject->SendAcknowledgedData(channelNumber, aucTxBuf);
}
}
else {
qDebug() << "HUB#" << stickNumber << "this sensor is too far, do not send load to it..." << antID;
}
}
checkToOpenChannelFEC(antID) {
//can open up to 8 channel per stick
// simplified code for forums, in actual, we ask permission if we can control this trainer, if it's not currently being controlled by another stick, the parent will let use control the trainer (we open a channel to it)
pclMessageObject->AssignChannel(currentLastChannel, 0, USER_NETWORK_NUM);
pclMessageObject->SetChannelID(currentLastChannel, antID, constants::fecDeviceType, constants::transTypeFec);
}
——————————————————
Free Indoor Cycling Software - https://maximumtrainer.com