This commit is contained in:
120
app/main.c
120
app/main.c
@@ -49,21 +49,6 @@
|
||||
#include "ui/ui.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define T9Count 9
|
||||
|
||||
const char T9Table[10][T9Count] = {
|
||||
{'#', '(', ')', ';', ':', '<', '>', '/', '0'},
|
||||
{',', '.', '?', '&', '!', ' ', '-', '_', '1'},
|
||||
{'a', 'b', 'c', 'A', 'B', 'C', '[', ']', '2'},
|
||||
{'d', 'e', 'f', 'D', 'E', 'F', '@', '%', '3'},
|
||||
{'g', 'h', 'i', 'G', 'H', 'I', '~', '$', '4'},
|
||||
{'j', 'k', 'l', 'J', 'K', 'L', '|', '*', '5'},
|
||||
{'m', 'n', 'o', 'M', 'N', 'O', '{', '}', '6'},
|
||||
{'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S', '7'},
|
||||
{'t', 'u', 'v', 'T', 'U', 'V', '"', '\'', '8'},
|
||||
{'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9'}
|
||||
};
|
||||
|
||||
static void toggle_chan_scanlist(void) { // toggle the selected channels scanlist setting
|
||||
|
||||
if (SCANNER_IsScanning())
|
||||
@@ -691,6 +676,11 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gWasFKeyPressed && bKeyPressed) {
|
||||
gRequestDisplayScreen = DISPLAY_MESSAGES;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bKeyPressed && !gDTMF_InputMode) { // menu key released
|
||||
const bool bFlag = !gInputBoxIndex;
|
||||
gInputBoxIndex = 0;
|
||||
@@ -906,11 +896,6 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
|
||||
void updatePrevChar(KEY_Code_t Key) {
|
||||
if (Key != prevKey) {
|
||||
prevKey = Key;
|
||||
}
|
||||
}
|
||||
|
||||
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -939,101 +924,6 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
// Key = KEY_SIDE2; // what's this doing ???
|
||||
// }
|
||||
|
||||
if (Key == KEY_9 && bKeyHeld) {
|
||||
if (bKeyPressed) {
|
||||
if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||
gEnteringSMS = SMS_ENTERING_DEST;
|
||||
updatePrevChar(Key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Key == KEY_MENU) {
|
||||
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||
if (bKeyPressed) {
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
prepareDataPacket();
|
||||
dataPacket.flags = 126;
|
||||
gEnteringSMS = SMS_ENTERING_MESSAGE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (bKeyPressed) {
|
||||
if (strlen((char *) dataPacket.data)) {
|
||||
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||
: gEeprom.TX_VFO;
|
||||
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||
|
||||
RADIO_PrepareTX();
|
||||
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||
MSG_FSKSendData(&dataPacket);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
//MSG_EnableRX(true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
}
|
||||
gEnteringSMS = SMS_NOT_ENTERING;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Key == KEY_EXIT && gEnteringSMS != SMS_NOT_ENTERING) {
|
||||
if (bKeyHeld) {
|
||||
if (bKeyPressed) {
|
||||
gEnteringSMS = SMS_NOT_ENTERING;
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
}
|
||||
} else {
|
||||
if (bKeyPressed) {
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (dataPacket.data <= dataPTR) {
|
||||
*dataPTR = '\0';
|
||||
if (dataPacket.data < dataPTR) {
|
||||
dataPTR--;
|
||||
}
|
||||
*dataPTR = '\0';
|
||||
}
|
||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||
dataPacket.dest /= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
updatePrevChar(Key);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gEnteringSMS != SMS_NOT_ENTERING && !bKeyHeld) {
|
||||
if (!dataPTR) {
|
||||
dataPTR = dataPacket.data;
|
||||
}
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (bKeyPressed) {
|
||||
if (prevKey != Key) {
|
||||
dataPTR++;
|
||||
if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
||||
dataPTR = dataPacket.data;
|
||||
}
|
||||
prevLetter = 0;
|
||||
}
|
||||
*(dataPTR - 1) = T9Table[Key][(prevLetter++) % T9Count];
|
||||
updatePrevChar(Key);
|
||||
}
|
||||
return;
|
||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||
if (bKeyPressed) {
|
||||
dataPacket.dest *= 10;
|
||||
dataPacket.dest += Key;
|
||||
prevLetter = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (Key) {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case KEY_SIDE1:
|
||||
|
Reference in New Issue
Block a user