Przeglądaj źródła

[FL-1891] Release 0.42 bugfixes (#891)

* Fixed the "ibutton can only emulate after reading" bug
* Fixed previous fix. FIXES FOR THE FIX GOD! BUGS FOR THE BUG THRONE!
* Fixed "Repeat code" position on code input screen
* Changed CAME protocol icon
* Brewfile: add imagemagick missing assets compiler dependency
* Correct fix for "Repeat code" position on code input screen

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
SG 4 lat temu
rodzic
commit
58ce937321

+ 2 - 1
Brewfile

@@ -3,4 +3,5 @@ brew "protobuf"
 brew "heatshrink"
 brew "heatshrink"
 brew "open-ocd"
 brew "open-ocd"
 brew "clang-format"
 brew "clang-format"
-brew "dfu-util"
+brew "dfu-util"
+brew "imagemagick"

+ 1 - 1
applications/gui/modules/code_input.c

@@ -312,7 +312,7 @@ static void code_input_view_draw_callback(Canvas* canvas, void* _model) {
             44 + y_offset,
             44 + y_offset,
             model->current);
             model->current);
 
 
-        if(model->current) canvas_draw_str(canvas, 2, 39 - y_offset, "Repeat code");
+        if(model->current) canvas_draw_str(canvas, 2, 39 + y_offset, "Repeat code");
 
 
         break;
         break;
     default:
     default:

+ 4 - 0
applications/ibutton/helpers/key-emulator.cpp

@@ -17,6 +17,9 @@ void KeyEmulator::start(iButtonKey* key) {
     anything_emulated = false;
     anything_emulated = false;
     stop();
     stop();
 
 
+    // pulldown pull pin, to prevent low-pass filtering by the RFID part of the schematic
+    furi_hal_rfid_pin_pull_pulldown();
+
     switch(key->get_key_type()) {
     switch(key->get_key_type()) {
     case iButtonKeyType::KeyDallas:
     case iButtonKeyType::KeyDallas:
         start_dallas_emulate(key);
         start_dallas_emulate(key);
@@ -44,6 +47,7 @@ bool KeyEmulator::emulated() {
 void KeyEmulator::stop() {
 void KeyEmulator::stop() {
     onewire_slave->stop();
     onewire_slave->stop();
     pulser.stop();
     pulser.stop();
+    furi_hal_rfid_pins_reset();
 }
 }
 
 
 void KeyEmulator::start_cyfral_emulate(iButtonKey* key) {
 void KeyEmulator::start_cyfral_emulate(iButtonKey* key) {

+ 8 - 5
applications/ibutton/helpers/key-reader.cpp

@@ -115,12 +115,10 @@ bool KeyReader::verify_key(iButtonKeyType key_type, const uint8_t* const data, u
 }
 }
 
 
 void KeyReader::start_comaparator(void) {
 void KeyReader::start_comaparator(void) {
-    // pulldown lf-rfid pins to prevent interference
-    hal_gpio_init(&gpio_rfid_pull, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
-    hal_gpio_write(&gpio_rfid_pull, false);
+    furi_hal_rfid_pins_reset();
 
 
-    hal_gpio_init(&gpio_rfid_carrier_out, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
-    hal_gpio_write(&gpio_rfid_carrier_out, false);
+    // pulldown pull pin, we sense the signal through the analog part of the RFID schematic
+    furi_hal_rfid_pin_pull_pulldown();
 
 
     comparator_callback_pointer =
     comparator_callback_pointer =
         cbc::obtain_connector(this, &KeyReader::comparator_trigger_callback);
         cbc::obtain_connector(this, &KeyReader::comparator_trigger_callback);
@@ -130,6 +128,11 @@ void KeyReader::start_comaparator(void) {
 }
 }
 
 
 void KeyReader::stop_comaparator(void) {
 void KeyReader::stop_comaparator(void) {
+    furi_hal_rfid_pins_reset();
+
+    // rfid_pins_reset will disable ibutton pin
+    furi_hal_ibutton_start();
+
     HAL_COMP_Stop(&hcomp1);
     HAL_COMP_Stop(&hcomp1);
     api_interrupt_remove(comparator_callback_pointer, InterruptTypeComparatorTrigger);
     api_interrupt_remove(comparator_callback_pointer, InterruptTypeComparatorTrigger);
 }
 }

+ 1 - 1
applications/ibutton/helpers/pulse-sequencer.cpp

@@ -56,7 +56,7 @@ void PulseSequencer::init_timer(uint32_t period) {
 
 
     HAL_NVIC_EnableIRQ(TIM1_UP_TIM16_IRQn);
     HAL_NVIC_EnableIRQ(TIM1_UP_TIM16_IRQn);
 
 
-    hal_gpio_init(&ibutton_gpio, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
+    hal_gpio_init(&ibutton_gpio, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedVeryHigh);
 }
 }
 
 
 void PulseSequencer::deinit_timer() {
 void PulseSequencer::deinit_timer() {

+ 3 - 1
applications/lfrfid/helpers/rfid-writer.cpp

@@ -37,7 +37,9 @@ void RfidWriter::start() {
     furi_hal_rfid_tim_read(125000, 0.5);
     furi_hal_rfid_tim_read(125000, 0.5);
     furi_hal_rfid_pins_read();
     furi_hal_rfid_pins_read();
     furi_hal_rfid_tim_read_start();
     furi_hal_rfid_tim_read_start();
-    hal_gpio_write(&gpio_rfid_pull, true);
+
+    // do not ground the antenna
+    furi_hal_rfid_pin_pull_release();
 }
 }
 
 
 void RfidWriter::stop() {
 void RfidWriter::stop() {

+ 8 - 0
firmware/targets/f6/furi-hal/furi-hal-rfid.c

@@ -61,6 +61,14 @@ void furi_hal_rfid_pins_read() {
     hal_gpio_init(&gpio_rfid_data_in, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
     hal_gpio_init(&gpio_rfid_data_in, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
 }
 }
 
 
+void furi_hal_rfid_pin_pull_release() {
+    hal_gpio_write(&gpio_rfid_pull, true);
+}
+
+void furi_hal_rfid_pin_pull_pulldown() {
+    hal_gpio_write(&gpio_rfid_pull, false);
+}
+
 void furi_hal_rfid_tim_read(float freq, float duty_cycle) {
 void furi_hal_rfid_tim_read(float freq, float duty_cycle) {
     // TODO LL init
     // TODO LL init
     uint32_t period = (uint32_t)((SystemCoreClock) / freq) - 1;
     uint32_t period = (uint32_t)((SystemCoreClock) / freq) - 1;

+ 8 - 0
firmware/targets/f7/furi-hal/furi-hal-rfid.c

@@ -66,6 +66,14 @@ void furi_hal_rfid_pins_read() {
     hal_gpio_init(&gpio_rfid_data_in, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
     hal_gpio_init(&gpio_rfid_data_in, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
 }
 }
 
 
+void furi_hal_rfid_pin_pull_release() {
+    hal_gpio_write(&gpio_rfid_pull, true);
+}
+
+void furi_hal_rfid_pin_pull_pulldown() {
+    hal_gpio_write(&gpio_rfid_pull, false);
+}
+
 void furi_hal_rfid_tim_read(float freq, float duty_cycle) {
 void furi_hal_rfid_tim_read(float freq, float duty_cycle) {
     // TODO LL init
     // TODO LL init
     uint32_t period = (uint32_t)((SystemCoreClock) / freq) - 1;
     uint32_t period = (uint32_t)((SystemCoreClock) / freq) - 1;

+ 8 - 0
firmware/targets/furi-hal-include/furi-hal-rfid.h

@@ -29,6 +29,14 @@ void furi_hal_rfid_pins_emulate();
  */
  */
 void furi_hal_rfid_pins_read();
 void furi_hal_rfid_pins_read();
 
 
+/** Release rfid pull pin
+ */
+void furi_hal_rfid_pin_pull_release();
+
+/** Pulldown rfid pull pin
+ */
+void furi_hal_rfid_pin_pull_pulldown();
+
 /** Config rfid timer to read state
 /** Config rfid timer to read state
  *
  *
  * @param      freq        timer frequency
  * @param      freq        timer frequency

+ 1 - 1
lib/subghz/protocols/subghz_protocol_came_atomo.c

@@ -26,7 +26,7 @@ SubGhzProtocolCameAtomo* subghz_protocol_came_atomo_alloc() {
     instance->common.te_short = 600;
     instance->common.te_short = 600;
     instance->common.te_long = 1200;
     instance->common.te_long = 1200;
     instance->common.te_delta = 250;
     instance->common.te_delta = 250;
-    instance->common.type_protocol = SubGhzProtocolCommonTypeStatic;
+    instance->common.type_protocol = SubGhzProtocolCommonTypeDynamic;
     instance->common.to_string = (SubGhzProtocolCommonToStr)subghz_protocol_came_atomo_to_str;
     instance->common.to_string = (SubGhzProtocolCommonToStr)subghz_protocol_came_atomo_to_str;
     instance->common.to_load_protocol =
     instance->common.to_load_protocol =
         (SubGhzProtocolCommonLoadFromRAW)subghz_decoder_came_atomo_to_load_protocol;
         (SubGhzProtocolCommonLoadFromRAW)subghz_decoder_came_atomo_to_load_protocol;