Skip to content

Commit bbc383f

Browse files
committed
src: remove commented code
1 parent 8143b3c commit bbc383f

11 files changed

+9
-61
lines changed

src/ble/gatt-service/cycling_power_service_server.c

-14
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ static void cycling_power_service_vector_can_send_now(void * context){
393393
break;
394394
}
395395
case CP_VECTOR_FLAG_FIRST_CRANK_MEASUREMENT_ANGLE_PRESENT:
396-
// printf("CP_VECTOR_FLAG_FIRST_CRANK_MEASUREMENT_ANGLE_PRESENT \n");
397396
little_endian_store_16(value, pos, instance->vector_first_crank_measurement_angle_deg);
398397
pos += 2;
399398
break;
@@ -572,11 +571,6 @@ static void cycling_power_service_response_can_send_now(void * context){
572571
return;
573572
}
574573

575-
// if (instance->w4_indication_complete){
576-
// printf("cycling_power_service_response_can_send_now: w4_indication_complete\n");
577-
// return;
578-
// }
579-
580574
// use preprocessor instead of btstack_max to get compile-time constant
581575
#if (CP_SENSOR_LOCATION_RESERVED > (CYCLING_POWER_MANUFACTURER_SPECIFIC_DATA_MAX_SIZE + 5))
582576
#define MAX_RESPONSE_PAYLOAD CP_SENSOR_LOCATION_RESERVED
@@ -669,8 +663,6 @@ static void cycling_power_service_response_can_send_now(void * context){
669663
uint8_t status = att_server_indicate(instance->con_handle, instance->control_point_value_handle, &value[0], pos);
670664
if (status == ERROR_CODE_SUCCESS){
671665
instance->w4_indication_complete = 1;
672-
// printf("cycling_power_service_response_can_send_now: set w4_indication_complete\n");
673-
// printf("can_send_now set opcode to CP_OPCODE_IDLE\n");
674666
instance->request_opcode = CP_OPCODE_IDLE;
675667
} else {
676668
log_error("can_send_now failed 0x%2x", status);
@@ -686,7 +678,6 @@ static int cycling_power_service_write_callback(hci_con_handle_t con_handle, uin
686678
cycling_power_sensor_location_t location;
687679
cycling_power_t * instance = &cycling_power;
688680

689-
// printf("cycling_power_service_write_callback: attr handle 0x%02x\n", attribute_handle);
690681
if (attribute_handle == instance->measurement_client_configuration_descriptor_handle){
691682
if (buffer_size < 2u){
692683
return ATT_ERROR_INVALID_OFFSET;
@@ -860,7 +851,6 @@ static int cycling_power_service_write_callback(hci_con_handle_t con_handle, uin
860851
((has_feature(CP_FEATURE_FLAG_SENSOR_MEASUREMENT_CONTEXT) == CP_SENSOR_MEASUREMENT_CONTEXT_FORCE) ||
861852
(has_feature(CP_FEATURE_FLAG_SENSOR_MEASUREMENT_CONTEXT) == CP_SENSOR_MEASUREMENT_CONTEXT_TORQUE))
862853
){
863-
// printf("start offset compensation procedure, enhanced %d\n", (instance->request_opcode == CP_OPCODE_START_ENHANCED_OFFSET_COMPENSATION));
864854
uint8_t event[7];
865855
int index = 0;
866856
event[index++] = HCI_EVENT_GATTSERVICE_META;
@@ -934,8 +924,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
934924
instance->con_handle = hci_subevent_le_connection_complete_get_connection_handle(packet);
935925
// print connection parameters (without using float operations)
936926
instance->con_interval = hci_subevent_le_connection_complete_get_conn_interval(packet);
937-
// printf("Initial Connection Interval: %u, %u.%02u ms\n", instance->con_interval, instance->con_interval * 125 / 100, 25 * (instance->con_interval & 3));
938-
// printf("Initial Connection Latency: %u\n", hci_subevent_le_connection_complete_get_conn_latency(packet));
939927
instance->con_interval_status = CP_CONNECTION_INTERVAL_STATUS_RECEIVED;
940928
break;
941929

@@ -1112,7 +1100,6 @@ void cycling_power_service_add_energy(uint16_t energy_kJ){
11121100
} else {
11131101
instance->accumulated_energy_kJ = 0xffff;
11141102
}
1115-
// printf("energy %d\n", instance->accumulated_energy_kJ);
11161103
}
11171104

11181105
void cycling_power_service_server_set_instantaneous_power(int16_t instantaneous_power_watt){
@@ -1234,7 +1221,6 @@ void cycling_power_service_server_packet_handler(btstack_packet_handler_t callba
12341221
void cycling_power_server_calibration_done(cycling_power_sensor_measurement_context_t measurement_type, uint16_t calibrated_value){
12351222
cycling_power_t * instance = &cycling_power;
12361223
if (instance->response_value != CP_RESPONSE_VALUE_W4_VALUE_AVAILABLE){
1237-
// printf("cycling_power_server_calibration_done : CP_RESPONSE_VALUE_W4_VALUE_AVAILABLE con_handle 0x%02x\n", instance->con_handle);
12381224
return;
12391225
}
12401226
instance->response_value = CP_RESPONSE_VALUE_SUCCESS;

src/ble/gatt-service/cycling_speed_and_cadence_service_server.c

-14
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ static uint16_t cycling_speed_and_cadence_service_read_callback(hci_con_handle_t
138138
static void cycling_speed_and_cadence_service_csc_measurement_can_send_now(void * context){
139139
cycling_speed_and_cadence_t * instance = (cycling_speed_and_cadence_t *) context;
140140
if (!instance){
141-
// printf("instance is null (cycling_speed_and_cadence_service_csc_measurement_can_send_now)\n");
142141
return;
143142
}
144143
uint8_t flags = (instance->wheel_revolution_data_supported << CSC_FLAG_WHEEL_REVOLUTION_DATA_SUPPORTED);
@@ -153,7 +152,6 @@ static void cycling_speed_and_cadence_service_csc_measurement_can_send_now(void
153152
pos += 4;
154153
little_endian_store_16(value, pos, instance->last_wheel_event_time);
155154
pos += 2;
156-
// printf("send cumulative 0x%04x\n", instance->cumulative_wheel_revolutions);
157155
}
158156

159157
if (instance->crank_revolution_data_supported){
@@ -169,7 +167,6 @@ static void cycling_speed_and_cadence_service_csc_measurement_can_send_now(void
169167
static void cycling_speed_and_cadence_service_response_can_send_now(void * context){
170168
cycling_speed_and_cadence_t * instance = (cycling_speed_and_cadence_t *) context;
171169
if (!instance){
172-
// printf("instance is null (cycling_speed_and_cadence_service_response_can_send_now)\n");
173170
return;
174171
}
175172

@@ -216,16 +213,12 @@ static int cycling_speed_and_cadence_service_write_callback(hci_con_handle_t con
216213
UNUSED(buffer_size);
217214
cycling_speed_and_cadence_t * instance = &cycling_speed_and_cadence;
218215

219-
// printf("cycling_speed_and_cadence_service_write_callback: attr handle 0x%02x\n", attribute_handle);
220216
if (attribute_handle == instance->measurement_client_configuration_descriptor_handle){
221217
if (buffer_size < 2u){
222218
return ATT_ERROR_INVALID_OFFSET;
223219
}
224220
instance->measurement_client_configuration_descriptor_notify = little_endian_read_16(buffer, 0);
225221
instance->con_handle = con_handle;
226-
// if (instance->measurement_client_configuration_descriptor_notify){
227-
// printf("enable notification\n");
228-
// }
229222
return 0;
230223
}
231224

@@ -235,9 +228,6 @@ static int cycling_speed_and_cadence_service_write_callback(hci_con_handle_t con
235228
}
236229
instance->control_point_client_configuration_descriptor_indicate = little_endian_read_16(buffer, 0);
237230
instance->con_handle = con_handle;
238-
// if (instance->control_point_client_configuration_descriptor_indicate){
239-
// printf("enable indication\n");
240-
// }
241231
return 0;
242232
}
243233

@@ -276,7 +266,6 @@ static int cycling_speed_and_cadence_service_write_callback(hci_con_handle_t con
276266
instance->response_value = CSC_RESPONSE_VALUE_OP_CODE_NOT_SUPPORTED;
277267
break;
278268
}
279-
// printf("control point, opcode %02x, response %02x\n", instance->request_opcode, instance->response_value);
280269

281270
if (instance->control_point_client_configuration_descriptor_indicate){
282271
instance->control_point_callback.callback = &cycling_speed_and_cadence_service_response_can_send_now;
@@ -286,7 +275,6 @@ static int cycling_speed_and_cadence_service_write_callback(hci_con_handle_t con
286275
return 0;
287276
}
288277

289-
// printf("heart_rate_service_read_callback, not handeled read on handle 0x%02x\n", attribute_handle);
290278
return 0;
291279
}
292280

@@ -351,7 +339,6 @@ static void cycling_speed_and_cadence_service_calculate_cumulative_wheel_revolut
351339
instance->cumulative_wheel_revolutions = 0xffffffff;
352340
}
353341
}
354-
// printf("cumulative 0x%04x, wheel revolution change %d\n", instance->cumulative_wheel_revolutions, revolutions_change);
355342
}
356343

357344
static void cycling_speed_and_cadence_service_calculate_cumulative_crank_revolutions(uint16_t revolutions_change){
@@ -377,7 +364,6 @@ void cycling_speed_and_cadence_service_server_update_values(int32_t wheel_revolu
377364
if (instance->measurement_client_configuration_descriptor_notify){
378365
instance->measurement_callback.callback = &cycling_speed_and_cadence_service_csc_measurement_can_send_now;
379366
instance->measurement_callback.context = (void*) instance;
380-
// printf("cycling_speed_and_cadence_service_server_update_values instance %p, context %p\n", instance, instance->measurement_callback.context);
381367
att_server_register_can_send_now_callback(&instance->measurement_callback, instance->con_handle);
382368
}
383369
}

src/btstack_hid_parser.c

-2
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ int btstack_hid_get_report_size_for_id(int report_id, hid_report_type_t report_t
433433
while (hid_descriptor_len){
434434
int valid_report_type = 0;
435435
hid_descriptor_item_t item;
436-
// printf("item: 0x%02x (%p)\n", *hid_descriptor, hid_descriptor);
437436
btstack_hid_parse_descriptor_item(&item, hid_descriptor, hid_descriptor_len);
438437
switch (item.item_type){
439438
case Global:
@@ -495,7 +494,6 @@ hid_report_id_status_t btstack_hid_id_valid(int report_id, uint16_t hid_descript
495494
switch ((GlobalItemTag)item.item_tag){
496495
case ReportID:
497496
current_report_id = item.item_value;
498-
// printf("current ID %d, searched ID %d\n", current_report_id, report_id);
499497
if (current_report_id != report_id) break;
500498
return HID_REPORT_ID_VALID;
501499
default:

src/btstack_util.c

-3
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ char * uuid128_to_str(const uint8_t * uuid){
323323

324324
static char bd_addr_to_str_buffer[6*3]; // 12:45:78:01:34:67\0
325325
char * bd_addr_to_str(const bd_addr_t addr){
326-
// orig code
327-
// sprintf(bd_addr_to_str_buffer, "%02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
328-
// sprintf-free code
329326
char * p = bd_addr_to_str_buffer;
330327
int i;
331328
for (i = 0; i < 6 ; i++) {

src/classic/avrcp_controller.c

-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ static void avrcp_controller_emit_now_playing_info_event_done(btstack_packet_han
258258
pos += 2;
259259
event[pos++] = ctype;
260260
event[pos++] = status;
261-
// printf_hexdump(event, pos);
262261
(*callback)(HCI_EVENT_PACKET, 0, event, pos);
263262
}
264263

@@ -355,7 +354,6 @@ static void avrcp_parser_reset(avrcp_connection_t * connection){
355354
static void avrcp_parser_process_byte(uint8_t byte, avrcp_connection_t * connection, avrcp_command_type_t ctype){
356355
uint16_t attribute_total_value_len;
357356
uint32_t attribute_id;
358-
// printf("avrcp_parser_process_byte: %02x, state %02x\n", byte, connection->parser_state);
359357
switch(connection->parser_state){
360358
case AVRCP_PARSER_GET_ATTRIBUTE_HEADER:
361359
connection->parser_attribute_header[connection->parser_attribute_header_pos++] = byte;

src/classic/btstack_sbc_decoder_bluedroid.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,14 @@
4646
#include "btstack_config.h"
4747

4848
#include <stdint.h>
49-
#include <stdio.h>
49+
5050
#include <stdlib.h>
5151
#include <string.h>
5252

53+
#ifdef LOG_FRAME_STATUS
54+
#include <stdio.h>
55+
#endif
56+
5357
#include "btstack_sbc.h"
5458
#include "btstack_sbc_plc.h"
5559

@@ -197,8 +201,6 @@ void btstack_sbc_decoder_init(btstack_sbc_decoder_state_t * state, btstack_sbc_m
197201
static void append_received_sbc_data(bludroid_decoder_state_t * state, uint8_t * buffer, int size){
198202
int numFreeBytes = sizeof(state->frame_buffer) - state->bytes_in_frame_buffer;
199203

200-
// printf("append_received_sbc_data: bytes to append %u, sizeof %u, bytes in buffer %u, free %u\n", size,sizeof(state->frame_buffer), state->bytes_in_frame_buffer, numFreeBytes);
201-
202204
if (size > numFreeBytes){
203205
log_error("SBC data: more bytes read %u than free bytes in buffer %u", size, numFreeBytes);
204206
}

src/classic/btstack_sbc_encoder_bluedroid.c

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#include "btstack_config.h"
4747

4848
#include <stdint.h>
49-
#include <stdio.h>
5049
#include <stdlib.h>
5150
#include <string.h>
5251

src/classic/btstack_sbc_plc.c

-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ uint8_t * btstack_sbc_plc_zero_signal_frame(void){
150150
void btstack_sbc_plc_init(btstack_sbc_plc_state_t *plc_state){
151151
plc_state->nbf=0;
152152
plc_state->bestlag=0;
153-
// printf("size\n");
154153
memset(plc_state->hist,0,sizeof(plc_state->hist));
155154
}
156155

src/classic/hfp_ag.c

-3
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,6 @@ static int codecs_exchange_state_machine(hfp_connection_t * hfp_connection){
516516
break;
517517
}
518518

519-
// printf(" -> State machine: CC\n");
520-
521519
switch (hfp_connection->command){
522520
case HFP_CMD_AVAILABLE_CODECS:
523521
if (hfp_connection->state < HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED){
@@ -1101,7 +1099,6 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
11011099
int callheld_indicator_index = get_ag_indicator_index_for_name("callheld");
11021100
int call_indicator_index = get_ag_indicator_index_for_name("call");
11031101

1104-
//printf("hfp_ag_call_sm event %d \n", event);
11051102
switch (event){
11061103
case HFP_AG_INCOMING_CALL:
11071104
switch (hfp_gsm_call_status()){

src/classic/hid_device.c

-15
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ static hid_handshake_param_type_t hid_device_set_report_cmd_is_valid(uint16_t ci
417417
default:
418418
break;
419419
}
420-
// printf("hid_device_set_report_cmd_is_valid: report_id %d, status %d \n", report_id, report_id_status);
421420
}
422421

423422
if (!hid_report_size_valid(cid, report_id, report_type, report_size-pos)){
@@ -450,7 +449,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
450449
return;
451450
}
452451
message_type = (hid_message_type_t)(packet[0] >> 4);
453-
// printf("L2CAP_DATA_PACKET message_type %d, packet_size %d \n", message_type, packet_size);
454452
switch (message_type){
455453
case HID_MESSAGE_TYPE_GET_REPORT:
456454

@@ -527,7 +525,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
527525

528526
switch (device->protocol_mode){
529527
case HID_PROTOCOL_MODE_BOOT:
530-
// printf("HID_PROTOCOL_MODE_BOOT \n");
531528
if (packet_size < 3){
532529
device->report_status = HID_HANDSHAKE_PARAM_TYPE_ERR_INVALID_PARAMETER;
533530
break;
@@ -538,7 +535,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
538535
(*hci_device_set_report)(device->cid, device->report_type, packet_size-1, &packet[1]);
539536
break;
540537
case HID_PROTOCOL_MODE_REPORT:
541-
// printf("HID_PROTOCOL_MODE_REPORT \n");
542538
device->report_status = hid_device_set_report_cmd_is_valid(device->cid, device->report_type, packet_size - 1, &packet[1]);
543539
if (device->report_status != HID_HANDSHAKE_PARAM_TYPE_SUCCESSFUL) break;
544540

@@ -557,15 +553,13 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
557553
l2cap_request_can_send_now_event(device->control_cid);
558554
break;
559555
case HID_MESSAGE_TYPE_GET_PROTOCOL:
560-
// printf(" HID_MESSAGE_TYPE_GET_PROTOCOL\n");
561556
device->state = HID_DEVICE_W2_GET_PROTOCOL;
562557
if (packet_size != 1) {
563558
device->report_status = HID_HANDSHAKE_PARAM_TYPE_ERR_INVALID_PARAMETER;
564559
break;
565560
}
566561
device->report_status = HID_HANDSHAKE_PARAM_TYPE_SUCCESSFUL;
567562
// hid_device_request_can_send_now_event(channel);
568-
// printf("HID_MESSAGE_TYPE_GET_PROTOCOL l2cap_request_can_send_now_event\n");
569563
l2cap_request_can_send_now_event(device->control_cid);
570564
break;
571565

@@ -583,10 +577,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
583577
device->protocol_mode = (hid_protocol_mode_t) param;
584578
switch (device->protocol_mode){
585579
case HID_PROTOCOL_MODE_BOOT:
586-
// printf("Set protocol mode to BOOT\n");
587580
break;
588581
case HID_PROTOCOL_MODE_REPORT:
589-
// printf("Set protocol mode to REPORT\n");
590582
break;
591583
default:
592584
btstack_assert(false);
@@ -714,7 +706,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
714706

715707
// connect HID Interrupt for outgoing
716708
if ((device->incoming == 0) && (psm == PSM_HID_CONTROL)){
717-
// printf("Create outgoing HID Interrupt\n");
718709
status = l2cap_create_channel(packet_handler, device->bd_addr, PSM_HID_INTERRUPT, 48, &device->interrupt_cid);
719710
break;
720711
}
@@ -753,7 +744,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
753744
if (!device) return;
754745
switch (device->state){
755746
case HID_DEVICE_W2_GET_REPORT:{
756-
// printf("HID_DEVICE_W2_GET_REPORT. on entry device->report_status %d \n", device->report_status);
757747
if (device->report_status != HID_HANDSHAKE_PARAM_TYPE_SUCCESSFUL) {
758748
report[0] = (HID_MESSAGE_TYPE_HANDSHAKE << 4) | device->report_status;
759749
hid_device_send_control_message(device->cid, &report[0], 1);
@@ -765,11 +755,9 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
765755
if (device->report_id){
766756
report[pos++] = device->report_id;
767757
}
768-
// printf(" report size with header and id %d\n", pos);
769758

770759
report_size = 0;
771760
status = (*hci_device_get_report)(device->cid, device->report_type, device->report_id, &report_size, &report[pos]);
772-
// printf(" report size %d, status after callback %d, expected report_size %d\n", report_size + pos, status, device->report_size + pos);
773761

774762
switch (status){
775763
case 0:
@@ -802,7 +790,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
802790
// break;
803791
// }
804792

805-
// printf("report type %d, report_size %d, report_size %d \n", device->report_type, report_size, device->report_size);
806793
hid_device_send_control_message(device->cid, &report[0], device->report_size);
807794
// device->state = HID_DEVICE_IDLE;
808795
break;
@@ -814,13 +801,11 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
814801
break;
815802
case HID_DEVICE_W2_GET_PROTOCOL:
816803
if (device->report_status != HID_HANDSHAKE_PARAM_TYPE_SUCCESSFUL){
817-
// printf("send HID_MESSAGE_TYPE_HANDSHAKE, report_status %d \n", device->report_status);
818804
report[0] = (HID_MESSAGE_TYPE_HANDSHAKE << 4) | device->report_status;
819805
hid_device_send_control_message(device->cid, &report[0], 1);
820806
break;
821807
}
822808

823-
// printf("send HID_MESSAGE_TYPE_DATA, protocol_mode %d \n", device->protocol_mode);
824809
report[0] = (HID_MESSAGE_TYPE_DATA << 4);
825810
report[1] = device->protocol_mode;
826811
hid_device_send_control_message(device->cid, &report[0], 2);

0 commit comments

Comments
 (0)