Skip to content

Commit

Permalink
Merge pull request #68 from jacobeva/master
Browse files Browse the repository at this point in the history
Cleanup and fix display bug
  • Loading branch information
markqvist authored May 5, 2024
2 parents ef00392 + c2e7c70 commit 25a195a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
1 change: 0 additions & 1 deletion Bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ bool bt_setup_hw() {
Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback);
Bluefruit.Periph.setConnectCallback(bt_connect_callback);
Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback);
Bluefruit.Security.setIOCaps(true, true, false);
Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete);
const ble_gap_addr_t gap_addr = Bluefruit.getAddr();
char *data = (char*)malloc(BT_DEV_ADDR_LEN+1);
Expand Down
10 changes: 9 additions & 1 deletion Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ bool display_init() {
#endif

#if DISP_CUSTOM_ADDR == true
#if HAS_EEPROM
uint8_t display_address = EEPROM.read(eeprom_addr(ADDR_CONF_DADR));
#elif MCU_VARIANT == MCU_NRF52
uint8_t display_address = eeprom_read(eeprom_addr(ADDR_CONF_DADR));
#endif
if (display_address == 0xFF) display_address = DISP_ADDR;
#else
uint8_t display_address = DISP_ADDR;
Expand Down Expand Up @@ -188,7 +192,11 @@ bool display_init() {
disp_area.cp437(true);
display.cp437(true);

display_intensity = EEPROM.read(eeprom_addr(ADDR_CONF_DINT));
#if HAS_EEPROM
uint8_t display_intensity = EEPROM.read(eeprom_addr(ADDR_CONF_DINT));
#elif MCU_VARIANT == MCU_NRF52
uint8_t display_intensity = eeprom_read(eeprom_addr(ADDR_CONF_DINT));
#endif

return true;
}
Expand Down
4 changes: 4 additions & 0 deletions RNode_Firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ void setup() {
#endif

#if HAS_DISPLAY
#if HAS_EEPROM
if (EEPROM.read(eeprom_addr(ADDR_CONF_DSET)) != CONF_OK_BYTE) {
#elif MCU_VARIANT == MCU_NRF52
if (eeprom_read(eeprom_addr(ADDR_CONF_DSET)) != CONF_OK_BYTE) {
#endif
eeprom_update(eeprom_addr(ADDR_CONF_DSET), CONF_OK_BYTE);
eeprom_update(eeprom_addr(ADDR_CONF_DINT), 0xFF);
}
Expand Down
4 changes: 4 additions & 0 deletions Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ sx128x *LoRa = &sx128x_modem;
#include "Framing.h"
#include "MD5.h"

#if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52
uint8_t eeprom_read(uint32_t mapped_addr);
#endif

#if HAS_DISPLAY == true
#include "Display.h"
#endif
Expand Down
8 changes: 8 additions & 0 deletions sx128x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ int sx128x::begin(unsigned long frequency)
delay(10);
}

if (_rxen != -1) {
pinMode(_rxen, OUTPUT);
}

if (_txen != -1) {
pinMode(_txen, OUTPUT);
}

if (_busy != -1) {
pinMode(_busy, INPUT);
}
Expand Down

0 comments on commit 25a195a

Please sign in to comment.