Skip to content

Commit

Permalink
Ham: preliminary support for T-TWR V2.1 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Linar Yusupov committed Jan 17, 2024
1 parent 40dba2f commit 1d6f0d8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
Binary file added documents/images/midi-7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/images/midi-8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions software/firmware/source/SoftRF/src/driver/OLED.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@

#include <U8x8lib.h>

#define SSD1306_OLED_I2C_ADDR 0x3C
#define SH1106_OLED_I2C_ADDR 0x3C /* 0x3D */
#define SSD1306_OLED_I2C_ADDR 0x3C
#define SH1106_OLED_I2C_ADDR 0x3C
#define SH1106_OLED_I2C_ADDR_ALT 0x3D

#define isTimeToOLED() (millis() - OLEDTimeMarker > 500)
#define isTimeToOLED() (millis() - OLEDTimeMarker > 500)

byte OLED_setup(void);
void OLED_loop(void);
Expand Down
30 changes: 29 additions & 1 deletion software/firmware/source/SoftRF/src/platform/ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,22 +1402,40 @@ static void ESP32_setup()

delay(200);

#if 0
calibrate_voltage((adc1_channel_t) ADC1_GPIO2_CHANNEL);
uint16_t gpio2_voltage = read_voltage(); // avg. of 32 samples

if (gpio2_voltage > 1900) {
#else
pinMode(SOC_GPIO_PIN_TWR2_RADIO_SQL, INPUT_PULLDOWN);

if (digitalRead(SOC_GPIO_PIN_TWR2_RADIO_SQL) == HIGH) {
#endif
esp32_board = ESP32_LILYGO_T_TWR_V2_1;
hw_info.revision = 21;

axp_2xxx.setALDO3Voltage(3300); // V2.1 - SA868, NeoPixel
axp_2xxx.setALDO3Voltage(3300); // V2.1 - SA868
axp_2xxx.enableALDO3();

#if defined(USE_SA8X8)
#if 0
if (gpio2_voltage > 2400) {
controller.setBand(Band::VHF);
} else {
controller.setBand(Band::UHF);
}
#else
Wire.begin(SOC_GPIO_PIN_TWR2_SDA , SOC_GPIO_PIN_TWR2_SCL);
Wire.beginTransmission(SSD1306_OLED_I2C_ADDR);
if (Wire.endTransmission() == 0) {
controller.setBand(Band::VHF);
}
Wire.beginTransmission(SH1106_OLED_I2C_ADDR_ALT);
if (Wire.endTransmission() == 0) {
controller.setBand(Band::UHF);
}
#endif
#endif /* USE_SA8X8 */
} else {
axp_2xxx.setDC3Voltage (3400); // V2.0 - SA868, NeoPixel
Expand Down Expand Up @@ -2997,11 +3015,21 @@ static byte ESP32_Display_setup()
}
} else if (hw_info.model == SOFTRF_MODEL_HAM) {
Wire.begin(SOC_GPIO_PIN_TWR2_SDA, SOC_GPIO_PIN_TWR2_SCL);

Wire.beginTransmission(SSD1306_OLED_I2C_ADDR);
has_oled = (Wire.endTransmission() == 0);
if (has_oled) {
u8x8 = &u8x8_1_3;
rval = DISPLAY_OLED_1_3;
} else {
/* T-TWR V2.1 UHF */
Wire.beginTransmission(SH1106_OLED_I2C_ADDR_ALT);
has_oled = (Wire.endTransmission() == 0);
if (has_oled) {
u8x8 = &u8x8_1_3;
u8x8->setI2CAddress(SH1106_OLED_I2C_ADDR_ALT);
rval = DISPLAY_OLED_1_3;
}
}
} else if (GPIO_21_22_are_busy) {
if (hw_info.model == SOFTRF_MODEL_PRIME_MK2 && hw_info.revision >= 8) {
Expand Down

0 comments on commit 1d6f0d8

Please sign in to comment.