gatt-service/cycling_power_service_server: offset compensation operation do not depend on extreme magnitudes

This commit is contained in:
Matthias Ringwald 2024-07-24 11:17:54 +02:00
parent ee5fda2379
commit ef34fc1487

View File

@ -863,17 +863,11 @@ static int cycling_power_service_write_callback(hci_con_handle_t con_handle, uin
case CP_OPCODE_START_OFFSET_COMPENSATION:
case CP_OPCODE_START_ENHANCED_OFFSET_COMPENSATION:
if (!has_feature(CP_FEATURE_FLAG_OFFSET_COMPENSATION_SUPPORTED)){
instance->response_value = CP_RESPONSE_VALUE_INVALID_PARAMETER;
break;
}
if (has_feature(CP_FEATURE_FLAG_EXTREME_MAGNITUDES_SUPPORTED)){
if (has_feature(CP_FEATURE_FLAG_OFFSET_COMPENSATION_SUPPORTED)){
instance->response_value = CP_RESPONSE_VALUE_W4_VALUE_AVAILABLE;
cycling_power_service_server_emit_start_calibration(instance, instance->request_opcode ==
CP_OPCODE_START_ENHANCED_OFFSET_COMPENSATION);
cycling_power_service_server_emit_start_calibration(instance, instance->request_opcode == CP_OPCODE_START_ENHANCED_OFFSET_COMPENSATION);
} else {
instance->current_force_magnitude_N = 0xffff;
instance->current_torque_magnitude_Nm = 0xffff;
instance->response_value = CP_RESPONSE_VALUE_INVALID_PARAMETER;
}
break;