From e4e02f610b9a49b9a5cd932c3b48efd948779629 Mon Sep 17 00:00:00 2001 From: manu Date: Mon, 18 Sep 2023 13:21:11 +0200 Subject: [PATCH] rssi things --- .github/workflows/main.yaml | 49 ++++++++++++++---------- .github/workflows/release.yaml | 58 ++++++++++++++++------------ ui/rssi.c | 69 ++++++++++++---------------------- 3 files changed, 88 insertions(+), 88 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 4a24b3c5..6fa654e3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -6,29 +6,40 @@ jobs: runs-on: ubuntu-22.04 steps: - - name: arm-none-eabi-gcc - uses: carlosperate/arm-none-eabi-gcc-action@v1 - with: - release: '10.3-2021.10' + - name: arm-none-eabi-gcc + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '10.3-2021.10' - - name: Install Python dependencies - run: python -m pip install --upgrade pip crcmod + - name: Install Python dependencies + run: python -m pip install --upgrade pip crcmod - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - name: Submodules - run: git submodule update --init --recursive --depth 1 + - name: Submodules + run: git submodule update --init --recursive --depth 1 - - name: Make - run: make + - name: CMake + run: cmake -DCMAKE_BUILD_TYPE=MinSizeDeb . - - name: size - run: arm-none-eabi-size firmware + - name: Make + run: make - - name: 'Upload Artifact' - uses: actions/upload-artifact@v3 - with: - name: firmware - path: firmware*.bin + - name: size + run: arm-none-eabi-size firmware.elf + - name: symbols + run: arm-none-eabi-nm firmware.elf > symbols.txt + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: firmware + path: firmware*.bin + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: symbols + path: symbols.txt \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 86b9241c..1b21530e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,34 +8,46 @@ jobs: runs-on: ubuntu-22.04 steps: - - name: arm-none-eabi-gcc - uses: carlosperate/arm-none-eabi-gcc-action@v1 - with: - release: '10.3-2021.10' + - name: arm-none-eabi-gcc + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '10.3-2021.10' - - name: Install Python dependencies - run: python3 -m pip install --upgrade pip crcmod + - name: Install Python dependencies + run: python -m pip install --upgrade pip crcmod - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - name: Submodules - run: git submodule update --init --recursive --depth 1 + - name: Submodules + run: git submodule update --init --recursive --depth 1 - - name: Make - run: make + - name: CMake + run: cmake -DCMAKE_BUILD_TYPE=MinSizeDeb . - - name: size - run: arm-none-eabi-size firmware + - name: Make + run: make - - name: 'Upload Artifact' - uses: actions/upload-artifact@v3 - with: - name: firmware - path: firmware*.bin + - name: size + run: arm-none-eabi-size firmware.elf - - name: 'Create Release' - uses: ncipollo/release-action@v1 - with: - artifacts: "firmware*.bin" + - name: symbols + run: arm-none-eabi-nm firmware.elf > symbols.txt + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: firmware + path: firmware*.bin + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: symbols + path: symbols.txt + + - name: 'Create Release' + uses: ncipollo/release-action@v1 + with: + artifacts: "firmware*.bin, symbols.txt" diff --git a/ui/rssi.c b/ui/rssi.c index a69ef154..55376b3c 100644 --- a/ui/rssi.c +++ b/ui/rssi.c @@ -22,52 +22,8 @@ #include "settings.h" #include "ui/rssi.h" #include "ui/ui.h" +#include "helper.h" -static void Render(uint8_t RssiLevel, uint8_t VFO) -{ - uint8_t *pLine; - uint8_t Line; - bool bIsClearMode; - - if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN) { - return; - } - - if (VFO == 0) { - pLine = gFrameBuffer[2]; - Line = 3; - } else { - pLine = gFrameBuffer[6]; - Line = 7; - } - - memset(pLine, 0, 23); - if (RssiLevel == 0) { - pLine = NULL; - bIsClearMode = true; - } else { - memcpy(pLine, BITMAP_Antenna, 5); - memcpy(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); - if (RssiLevel >= 2) { - memcpy(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); - } - if (RssiLevel >= 3) { - memcpy(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); - } - if (RssiLevel >= 4) { - memcpy(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4)); - } - if (RssiLevel >= 5) { - memcpy(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); - } - if (RssiLevel >= 6) { - memcpy(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6)); - } - bIsClearMode = false; - } - - ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode); -} void UI_UpdateRSSI(uint16_t RSSI) { @@ -87,7 +43,28 @@ void UI_UpdateRSSI(uint16_t RSSI) if (gVFO_RSSI_Level[gEeprom.RX_CHANNEL] != Level) { gVFO_RSSI_Level[gEeprom.RX_CHANNEL] = Level; - Render(Level, gEeprom.RX_CHANNEL); } + + if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN) { + return; + } + + //do the calculation + int16_t realRSSI = (int16_t)((RSSI >> 1) & 0xFF); + realRSSI = realRSSI - 160; + realRSSI *= -1; + + //rssi to string + char rssi_str[8]; + NUMBER_ToDigits(realRSSI, rssi_str); + + //which line + uint8_t line = gEeprom.RX_CHANNEL == 0 ? 2 : 6; + //print the rssi + UI_DisplaySmallDigits(3,rssi_str+5, 2, line); + //print the minus + gFrameBuffer[line][0] = 0x10; + gFrameBuffer[line][1] = 0x10; + ST7565_BlitFullScreen(); }