diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index f1112ec5..c16e972e 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -12,4 +12,4 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - uses: psf/black@stable + - uses: psf/black@20.8b1 diff --git a/applications/nfc/nfc_worker.c b/applications/nfc/nfc_worker.c index 11296bf2..150d176e 100644 --- a/applications/nfc/nfc_worker.c +++ b/applications/nfc/nfc_worker.c @@ -84,7 +84,7 @@ void nfc_worker_poll(NfcWorker* nfc_worker, uint8_t cycles) { is_found |= nfc_worker_nfcf_poll(nfc_worker); is_found |= nfc_worker_nfcv_poll(nfc_worker); rfalFieldOff(); - cycles--; + if(cycles > 0) cycles--; if((!is_found) && (!cycles)) { NfcMessage message; message.type = NfcMessageTypeDeviceNotFound; diff --git a/lib/ST25RFAL002/platform.c b/lib/ST25RFAL002/platform.c index c7c61636..ba750b00 100644 --- a/lib/ST25RFAL002/platform.c +++ b/lib/ST25RFAL002/platform.c @@ -37,6 +37,7 @@ void platformSetIrqCallback(PlatformIrqCallback callback) { } HAL_StatusTypeDef platformSpiTxRx(const uint8_t *txBuf, uint8_t *rxBuf, uint16_t len) { + furi_assert(platform_st25r3916); bool ret = false; if (txBuf && rxBuf) { ret = api_hal_spi_bus_trx(platform_st25r3916->bus, (uint8_t*)txBuf, rxBuf, len, 1000); @@ -55,12 +56,10 @@ HAL_StatusTypeDef platformSpiTxRx(const uint8_t *txBuf, uint8_t *rxBuf, uint16_t } void platformProtectST25RComm() { - furi_assert(platform_st25r3916 == NULL); platform_st25r3916 = (ApiHalSpiDevice*)api_hal_spi_device_get(ApiHalSpiDeviceIdNfc); } void platformUnprotectST25RComm() { furi_assert(platform_st25r3916); api_hal_spi_device_return(platform_st25r3916); - platform_st25r3916 = NULL; }