Skip to content

Commit

Permalink
Ham: T-TWR V2.1 speaker POST [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Feb 19, 2024
1 parent 52f3b7b commit 117c2e3
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
23 changes: 21 additions & 2 deletions software/app/Settings/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
const baudrate = 0;
const server = "";
const key = "";
const adb = 0;
const voice = 0;
const power_save = 0;

Expand All @@ -42,7 +41,7 @@
+ key + ","
+ document.getElementById("rotate").value + ","
+ document.getElementById("orientation").value + ","
+ adb + ","
+ document.getElementById("adb").value + ","
+ document.getElementById("idpref").value + ","
+ document.getElementById("vmode").value + ","
+ voice + ","
Expand Down Expand Up @@ -114,6 +113,13 @@
UpdateChecksum();
}

function SelADB()
{
var adb = document.getElementById("ADBs");
document.getElementById("adb").value = adb.options[adb.selectedIndex].value;
UpdateChecksum();
}

function SelIDPref()
{
var idpref = document.getElementById("IDPrefs");
Expand Down Expand Up @@ -151,6 +157,7 @@
document.getElementById("rotate").value = 0;
document.getElementById("orientation").value = 0;
document.getElementById("zoom").value = 2;
document.getElementById("adb").value = 3;
document.getElementById("idpref").value = 3;
document.getElementById("aghost").value = 0;
document.getElementById("filter").value = 0;
Expand Down Expand Up @@ -225,6 +232,17 @@ <h1 align=center>Interface settings</h1>
</td>
</tr>

<tr>
<th align=left>Aircrafts data</th>
<td align=right>
<select id="ADBs" onchange="SelADB()">
<option value='0'>off</option>
<option value='2'>FlarmNet</option>
<option selected value='3'>GliderNet</option>
</select>
</td>
</tr>

<tr>
<th align=left>ID preference</th>
<td align=right>
Expand Down Expand Up @@ -272,6 +290,7 @@ <h1 align=center>Interface settings</h1>
<!-- Rotation: --><input type="hidden" id="rotate" size="1">
<!-- Orientation: --><input type="hidden" id="orientation" size="1">
<!-- Zoom: --><input type="hidden" id="zoom" size="1">
<!-- ADB: --><input type="hidden" id="adb" size="1">
<!-- IDPref: --><input type="hidden" id="idpref" size="1">
<!-- AGhost: --><input hidden="text" id="aghost" size="1">
<!-- Filter: --><input type="hidden" id="filter" size="1">
Expand Down
31 changes: 30 additions & 1 deletion software/firmware/source/SoftRF/src/platform/ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ static void ESP32_setup()

axp_2xxx.setBLDO2Voltage(3300); // V2.1 - SA868
axp_2xxx.enableBLDO2();
// axp_2xxx.setALDO3Voltage(3300); // V2.1 - Amp. OE Ctrl
axp_2xxx.setALDO3Voltage(3300); // V2.1 - Amp. OE Ctrl

#if defined(USE_SA8X8)
#if 0
Expand Down Expand Up @@ -1684,6 +1684,35 @@ static void ESP32_post_init()
}
}
}

#if !defined(EXCLUDE_VOICE_MESSAGE)
if (esp32_board == ESP32_LILYGO_T_TWR_V2_1 && uSD_is_attached)
{
char filename[MAX_FILENAME_LEN];
strcpy(filename, WAV_FILE_PREFIX);
strcat(filename, "POST");
strcat(filename, WAV_FILE_SUFFIX);
if (uSD.exists(filename)) {
axp_2xxx.enableALDO3();
Audio_Sink->SetPinout(I2S_PIN_NO_CHANGE,
I2S_PIN_NO_CHANGE,
SOC_GPIO_PIN_TWR2_PDM_AUX,
I2S_PIN_NO_CHANGE);
Audio_Sink->SetGain(/* 0.0625 */ 0.125 /* 0.25 */);

play_file(filename);

axp_2xxx.disableALDO3();
I2S_Init((i2s_mode_t) (I2S_MODE_TX | I2S_MODE_PDM),
I2S_BITS_PER_SAMPLE_16BIT);
Audio_Sink->SetPinout(I2S_PIN_NO_CHANGE,
I2S_PIN_NO_CHANGE,
SOC_GPIO_PIN_TWR2_PDM_OUT,
I2S_PIN_NO_CHANGE);
Audio_Sink->SetGain(/* 0.0625 */ 0.125 /* 0.25 */);
}
}
#endif /* EXCLUDE_VOICE_MESSAGE */
#endif /* CONFIG_IDF_TARGET_ESP32S3 */

Serial.println();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

// Radio SPI (not in use)
#define SOC_GPIO_PIN_TWR2_MOSI 16
#define SOC_GPIO_PIN_TWR2_MISO 45
#define SOC_GPIO_PIN_TWR2_SCK 15
#define SOC_GPIO_PIN_TWR2_MISO 45 /* T-TWR 2.0 only */
#define SOC_GPIO_PIN_TWR2_SCK 15 /* T-TWR 2.0 only */
#define SOC_GPIO_PIN_TWR2_SS 14

// microSD
Expand All @@ -43,3 +43,6 @@
#define SOC_GPIO_PIN_TWR2_ENC_A 47
#define SOC_GPIO_PIN_TWR2_ENC_B 46

/* T-TWR 2.1 only */
#define SOC_GPIO_PIN_TWR2_PDM_AUX 45
#define SOC_GPIO_PIN_TWR2_MIC_ADC 15

0 comments on commit 117c2e3

Please sign in to comment.