[FL-1441] ApiHalVcp: use DTR signal for ready flag. Fix memory leak in subghz. (#519)

* ApiHalVcp: use DTR signal for ready flag. Fix memory leak in subghz.
* Backport VCP fix to F5
This commit is contained in:
あく 2021-06-16 09:14:59 +03:00 committed by GitHub
parent a0fdc559c9
commit 9e69164b1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -134,6 +134,10 @@ SubGhz* subghz_alloc() {
void subghz_free(SubGhz* subghz) { void subghz_free(SubGhz* subghz) {
furi_assert(subghz); furi_assert(subghz);
// Packet Test
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewStatic);
subghz_static_free(subghz->subghz_static);
// Packet Test // Packet Test
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewTestPacket); view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewTestPacket);
subghz_test_packet_free(subghz->subghz_test_packet); subghz_test_packet_free(subghz->subghz_test_packet);

View File

@ -43,9 +43,9 @@ void _api_hal_vcp_deinit() {
void _api_hal_vcp_control_line(uint8_t state) { void _api_hal_vcp_control_line(uint8_t state) {
// bit 0: DTR state, bit 1: RTS state // bit 0: DTR state, bit 1: RTS state
// bool dtr = state & 0b01; // bool dtr = state & 0b01;
bool rts = state & 0b10; bool dtr = state & 0b1;
if (rts) { if (dtr) {
if (!api_hal_vcp->alive) { if (!api_hal_vcp->alive) {
api_hal_vcp->alive = true; api_hal_vcp->alive = true;
_api_hal_vcp_rx_callback(&ascii_soh, 1); // SOH _api_hal_vcp_rx_callback(&ascii_soh, 1); // SOH

View File

@ -43,9 +43,9 @@ void _api_hal_vcp_deinit() {
void _api_hal_vcp_control_line(uint8_t state) { void _api_hal_vcp_control_line(uint8_t state) {
// bit 0: DTR state, bit 1: RTS state // bit 0: DTR state, bit 1: RTS state
// bool dtr = state & 0b01; // bool dtr = state & 0b01;
bool rts = state & 0b10; bool dtr = state & 0b1;
if (rts) { if (dtr) {
if (!api_hal_vcp->alive) { if (!api_hal_vcp->alive) {
api_hal_vcp->alive = true; api_hal_vcp->alive = true;
_api_hal_vcp_rx_callback(&ascii_soh, 1); // SOH _api_hal_vcp_rx_callback(&ascii_soh, 1); // SOH