Skip to content

Commit 6317d7e

Browse files
committed
switched reed input to pullup resistor for high frequency noise resistance
- fixed build flag
1 parent 45e70c0 commit 6317d7e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ OBC uses VSPI (can be HSPI, but I use it for debug) to connect to LCD:
7575
| RX2/G16 | BL |
7676
| GND | GND |
7777

78-
ReedSwitch -> ESP D21 PIN
78+
ReedSwitch -> ESP D21 PIN -> GND
7979

8080
JTAG CJMCU-2232HL (note to myself)
8181

@@ -86,10 +86,10 @@ JTAG CJMCU-2232HL (note to myself)
8686
| D15 | AD2 |
8787
| D14 | AD3 |
8888
| GND | GND |
89-
89+
## Micro fork version with battery
90+
Work in progress!
9091
## Standard version
9192
Soon
9293
## Standard version with battery
9394
Soon+
94-
## Micro fork version with battery
95-
Soon+++
95+

main/main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef NO_SCREEN
1+
#ifndef NO_SCREEN
22
#include "Tasks/screen_pcd8544/screen_pcd8544.h"
33
#include "driver/spi_common.h"
44
#endif
@@ -76,11 +76,12 @@ void vAttachInterrupts() {
7676
io_conf.mode = GPIO_MODE_INPUT;
7777
// bit mask of the pins that you want to set,e.g.GPIO18/19
7878
io_conf.pin_bit_mask = 1ULL << REED_IO_NUM;
79-
io_conf.pull_down_en = 1;
80-
io_conf.intr_type = GPIO_INTR_POSEDGE;
79+
io_conf.pull_up_en = 1;
80+
io_conf.pull_down_en = 0;
81+
io_conf.intr_type = GPIO_INTR_NEGEDGE;
8182
// configure GPIO with the given settings
8283
gpio_config(&io_conf);
83-
gpio_set_intr_type(REED_IO_NUM, GPIO_INTR_POSEDGE);
84+
gpio_set_intr_type(REED_IO_NUM, io_conf.intr_type);
8485
gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
8586
gpio_isr_handler_add(REED_IO_NUM, vReedISR, (void*)REED_IO_NUM);
8687
}

0 commit comments

Comments
 (0)