This commit is contained in:
@@ -24,6 +24,7 @@ const char T9Table[10][T9Count] = {
|
||||
|
||||
|
||||
uint8_t gActiveMessage = 0;
|
||||
uint8_t gActiveMessageBank = 0;
|
||||
|
||||
StoredPacket loadedPacket;
|
||||
|
||||
@@ -82,30 +83,41 @@ void MESSAGES_TimeSlice500ms(void) {
|
||||
|
||||
void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
gKeyTimeout = 1;
|
||||
if (gEnteringSMS != SMS_NOT_ENTERING && !bKeyHeld && Key <= KEY_9) {
|
||||
if (!dataPTR || dataPTR < dataPacket.data) {
|
||||
dataPTR = dataPacket.data;
|
||||
if (gEnteringSMS != SMS_NOT_ENTERING && Key <= KEY_9) {
|
||||
if (!bKeyHeld) {
|
||||
if (!dataPTR || dataPTR < dataPacket.data) {
|
||||
dataPTR = dataPacket.data;
|
||||
}
|
||||
}
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (bKeyPressed) {
|
||||
if (prevKey != Key) {
|
||||
dataPTR++;
|
||||
if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
||||
//if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
||||
if (dataPTR - dataPacket.data >= 19) {
|
||||
dataPTR = dataPacket.data;
|
||||
}
|
||||
prevLetter = 0;
|
||||
}
|
||||
*(dataPTR - 1) = T9Table[Key][(prevLetter++) % T9Count];
|
||||
*(dataPTR - 1) = T9Table[Key][prevLetter];
|
||||
if (!bKeyHeld) {
|
||||
prevLetter++;
|
||||
} else {
|
||||
prevLetter--;
|
||||
}
|
||||
prevLetter = (prevLetter) % T9Count;
|
||||
updatePrevChar(Key);
|
||||
}
|
||||
return;
|
||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||
if (bKeyPressed) {
|
||||
dataPacket.dest *= 10;
|
||||
dataPacket.dest += Key;
|
||||
prevLetter = 0;
|
||||
if (!bKeyHeld) {
|
||||
if (bKeyPressed) {
|
||||
dataPacket.dest *= 10;
|
||||
dataPacket.dest += Key;
|
||||
prevLetter = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,8 +155,7 @@ void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
|
||||
// second copy with MSB flipped (btn ^ 0x8) in the high nibble
|
||||
out[4] = ((btn ^ 0x8) << 4);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
out[0] = (dataPacket.dest >> 8) & 0xFF;
|
||||
out[1] = dataPacket.dest & 0xFF;
|
||||
}
|
||||
@@ -210,21 +221,43 @@ void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
}
|
||||
break;
|
||||
case KEY_UP:
|
||||
if (bKeyPressed) {
|
||||
gActiveMessage++;
|
||||
if (gActiveMessage > MESSAGES_COUNT) {
|
||||
gActiveMessage = 0;
|
||||
if (gEnteringSMS != SMS_NOT_ENTERING) {
|
||||
if (bKeyPressed) {
|
||||
gActiveMessageBank++;
|
||||
gActiveMessage = gActiveMessageBank * 3;
|
||||
if (gActiveMessage > MESSAGES_COUNT) {
|
||||
gActiveMessage = 0;
|
||||
}
|
||||
if (gActiveMessageBank >= MESSAGES_COUNT / 3) {
|
||||
gActiveMessageBank = 0;
|
||||
}
|
||||
MESSAGES_GET();
|
||||
}
|
||||
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
dataPTR++;
|
||||
//if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
||||
if (dataPTR - dataPacket.data >= 19) {
|
||||
dataPTR = dataPacket.data;
|
||||
}
|
||||
MESSAGES_GET();
|
||||
}
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
if (bKeyPressed) {
|
||||
gActiveMessage--;
|
||||
if (gActiveMessage > MESSAGES_COUNT) {
|
||||
gActiveMessage = MESSAGES_COUNT - 1;
|
||||
if (gEnteringSMS != SMS_NOT_ENTERING) {
|
||||
if (bKeyPressed) {
|
||||
gActiveMessageBank--;
|
||||
gActiveMessage = gActiveMessageBank * 3;
|
||||
if (gActiveMessage >= MESSAGES_COUNT) {
|
||||
gActiveMessage = MESSAGES_COUNT - 1;
|
||||
}
|
||||
if (gActiveMessageBank > MESSAGES_COUNT / 3) {
|
||||
gActiveMessageBank = MESSAGES_COUNT / 3 - 1;
|
||||
}
|
||||
MESSAGES_GET();
|
||||
}
|
||||
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (dataPacket.data < dataPTR) {
|
||||
dataPTR--;
|
||||
}
|
||||
MESSAGES_GET();
|
||||
}
|
||||
break;
|
||||
case KEY_EXIT:
|
||||
|
||||
Reference in New Issue
Block a user