Skip to content

Commit 7c62590

Browse files
committed
fix: probability
1 parent 5f9c21d commit 7c62590

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

pgpemu-esp32/main/pgp_gap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,20 @@ void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* par
6969
}
7070
break;
7171
case ESP_GAP_BLE_AUTH_CMPL_EVT:
72-
ESP_LOGI(BT_GAP_TAG, "New bonding done with device %d", esp_ble_get_bond_device_num());
72+
ESP_LOGI(BT_GAP_TAG, "new bonding done with device %d", esp_ble_get_bond_device_num());
7373

7474
read_stored_settings(true);
7575

7676
break;
7777
// PASSKEY
7878
case ESP_GAP_BLE_PASSKEY_REQ_EVT:
79-
ESP_LOGI(BT_GAP_TAG, "Passkey requested");
79+
ESP_LOGI(BT_GAP_TAG, "passkey requested");
8080
break;
8181
case ESP_GAP_BLE_PASSKEY_NOTIF_EVT:
82-
ESP_LOGI(BT_GAP_TAG, "Passkey notify with code %06" PRIu32, param->ble_security.key_notif.passkey);
82+
ESP_LOGI(BT_GAP_TAG, "passkey notify with code %06" PRIu32, param->ble_security.key_notif.passkey);
8383
break;
8484
case ESP_GAP_BLE_SEC_REQ_EVT:
85-
ESP_LOGI(BT_GAP_TAG, "Security request received, accepting");
85+
ESP_LOGI(BT_GAP_TAG, "security request received, accepting");
8686
esp_ble_gap_security_rsp(param->ble_security.ble_req.bd_addr, true);
8787
break;
8888
// CONNECTION STATUS

pgpemu-esp32/main/pgp_gatts.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,15 @@ void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts
598598
char_name_from_handle(param->write.handle));
599599
if (!param->write.is_prep) {
600600
// the data length of gattc write must be less than MAX_VALUE_LENGTH.
601-
ESP_LOGD(BT_GATTS_TAG, "GATT_WRITE_EVT handle=%d, value len=%d", param->write.handle, param->write.len);
601+
ESP_LOGD(BT_GATTS_TAG, "GATT_WRITE_EVT handle %d, value len %d", param->write.handle, param->write.len);
602602
if (esp_log_level_get(BT_GATTS_TAG) >= ESP_LOG_VERBOSE) {
603603
ESP_LOGV(BT_GATTS_TAG, "DATA FROM APP");
604604
ESP_LOG_BUFFER_HEX(BT_GATTS_TAG, param->write.value, param->write.len);
605605
}
606606

607+
ESP_LOGD(BT_GATTS_TAG, "idx %d tabl %d", IDX_CHAR_SFIDA_COMMANDS_CFG, certificate_handle_table[IDX_CHAR_SFIDA_COMMANDS_CFG]);
608+
ESP_LOGD(BT_GATTS_TAG, "idx %d tabl %d", IDX_CHAR_CENTRAL_TO_SFIDA_VAL, certificate_handle_table[IDX_CHAR_SFIDA_COMMANDS_CFG]);
609+
607610
if (certificate_handle_table[IDX_CHAR_SFIDA_COMMANDS_CFG] == param->write.handle) {
608611
uint16_t descr_value = param->write.value[1] << 8 | param->write.value[0];
609612
handle_pgp_handshake_first(gatts_if, descr_value, param->write.conn_id);
@@ -767,6 +770,8 @@ void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts
767770
}
768771
break;
769772
}
773+
case ESP_GATTS_SET_ATTR_VAL_EVT:
774+
break;
770775
default:
771776
ESP_LOGW(BT_GATTS_TAG, "%s: unhandled event %d", __func__, event);
772777
break;

pgpemu-esp32/main/pgp_led_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void handle_led_notify_from_app(esp_gatt_if_t gatts_if, uint16_t conn_id, const
136136
// blinking blue
137137
if (get_setting(&settings.autospin)) {
138138
uint8_t rnd = (esp_random() % (9 + 1));
139-
if (get_setting_uint8(&settings.autospin_probability) >= rnd) {
139+
if (get_setting_uint8(&settings.autospin_probability) > 0 && get_setting_uint8(&settings.autospin_probability) >= rnd) {
140140
ESP_LOGW(LEDHANDLER_TAG,
141141
"[%d] Pokestop in range but skipped due to %d > %d probability",
142142
conn_id,

0 commit comments

Comments
 (0)