From 361ca8b7501b27e29403a0811bf287edaeee5792 Mon Sep 17 00:00:00 2001 From: Max Andreev Date: Mon, 19 Dec 2022 20:09:19 +0300 Subject: [PATCH 1/3] Rollback new amap workflow (#2152) --- .github/workflows/amap_analyse.yml | 46 ++++++++++++++++++++++-------- .github/workflows/build.yml | 18 ------------ scripts/get_env.py | 9 ++---- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/.github/workflows/amap_analyse.yml b/.github/workflows/amap_analyse.yml index 7e78dc980..1340e4cde 100644 --- a/.github/workflows/amap_analyse.yml +++ b/.github/workflows/amap_analyse.yml @@ -1,8 +1,13 @@ name: 'Analyze .map file with Amap' on: - repository_dispatch: - types: [make_map_analyse] + push: + branches: + - dev + - "release*" + tags: + - '*' + pull_request: env: TARGETS: f7 @@ -10,9 +15,24 @@ env: jobs: amap_analyse: + if: ${{ !github.event.pull_request.head.repo.fork }} runs-on: [self-hosted,FlipperZeroMacShell] - timeout-minutes: 5 + timeout-minutes: 15 steps: + - name: 'Wait Build workflow' + uses: fountainhead/action-wait-for-check@v1.0.0 + id: wait-for-build + with: + token: ${{ secrets.GITHUB_TOKEN }} + checkName: 'main' + ref: ${{ github.event.pull_request.head.sha || github.sha }} + intervalSeconds: 20 + + - name: 'Check Build workflow status' + if: steps.wait-for-build.outputs.conclusion == 'failure' + run: | + exit 1 + - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then @@ -23,16 +43,18 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} - name: 'Get commit details' run: | - export COMMIT_HASH=${{ github.event.client_payload.commit_hash }} - export COMMIT_MSG=${{ github.event.client_payload.commit_msg }} - export BRANCH_NAME=${{ github.event.client_payload.branch_name }} - if [[ ${{ github.event.client_payload.event_type }} == "pr" ]]; then - export PULL_ID=${{ github.event.client_payload.pull_id }} - export PULL_NAME=${{ github.event.client_payload.pull_name }} + if [[ ${{ github.event_name }} == 'pull_request' ]]; then + TYPE="pull" + elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then + TYPE="tag" + else + TYPE="other" fi + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" - name: 'Make artifacts directory' run: | @@ -47,13 +69,13 @@ jobs: chmod 600 ./deploy_key; rsync -avzP \ -e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \ - ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${{ github.event.client_payload.branch_name }}/" artifacts/; + ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/" artifacts/; rm ./deploy_key; - name: 'Make .map file analyze' run: | cd artifacts/ - /Applications/amap/Contents/MacOS/amap -f flipper-z-f7-firmware-${{ github.event.client_payload.suffix }}.elf.map + /Applications/amap/Contents/MacOS/amap -f "flipper-z-f7-firmware-${SUFFIX}.elf.map" - name: 'Upload report to DB' run: | @@ -77,5 +99,5 @@ jobs: ${{ secrets.AMAP_MARIADB_HOST }} \ ${{ secrets.AMAP_MARIADB_PORT }} \ ${{ secrets.AMAP_MARIADB_DATABASE }} \ - artifacts/flipper-z-f7-firmware-${{ github.event.client_payload.suffix }}.elf.map.all + artifacts/flipper-z-f7-firmware-$SUFFIX.elf.map.all diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52d4626d8..2de0e57c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,24 +98,6 @@ jobs: artifacts/ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/"; rm ./deploy_key; - - name: 'Trigger map file analyser' - if: ${{ (github.event_name != 'pull_request') - && !github.event.pull_request.head.repo.fork }} - uses: peter-evans/repository-dispatch@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - event-type: make_map_analyse - client-payload: '{"branch_name": "${{steps.names.outputs.branch_name}}", "commit_hash": "${{steps.names.outputs.commit_hash}}", "commit_msg": "${{steps.names.outputs.commit_msg}}", "event_type": "push"}' - - - name: 'Trigger map file analyser' - if: ${{ (github.event_name == 'pull_request') - && !github.event.pull_request.head.repo.fork }} - uses: peter-evans/repository-dispatch@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - event-type: make_map_analyse - client-payload: '{"branch_name": "${{steps.names.outputs.branch_name}}", "commit_hash": "${{steps.names.outputs.commit_hash}}", "commit_msg": "${{steps.names.outputs.commit_msg}}", "pull_id": "${{steps.names.outputs.pull_id}}", "pull_name": "${{steps.names.outputs.pull_name}}", "event_type": "pr"}' - - name: 'Trigger update server reindex' if: ${{ !github.event.pull_request.head.repo.fork }} run: curl -X POST -F 'key=${{ secrets.REINDEX_KEY }}' ${{ secrets.REINDEX_URL }} diff --git a/scripts/get_env.py b/scripts/get_env.py index c87de47a3..e2da6eda5 100644 --- a/scripts/get_env.py +++ b/scripts/get_env.py @@ -89,18 +89,13 @@ def add_envs(data, gh_env_file, gh_out_file, args): add_env("BRANCH_NAME", data["branch_name"], gh_env_file) add_env("DIST_SUFFIX", data["suffix"], gh_env_file) add_env("WORKFLOW_BRANCH_OR_TAG", data["branch_name"], gh_env_file) - add_set_output_var("commit_msg", data["commit_comment"], gh_out_file) - add_set_output_var("commit_hash", data["commit_hash"], gh_out_file) - add_set_output_var("commit_sha", data["commit_sha"], gh_out_file) - add_set_output_var("suffix", data["suffix"], gh_out_file) add_set_output_var("branch_name", data["branch_name"], gh_out_file) - add_set_output_var("dist_suffix", data["suffix"], gh_out_file) + add_set_output_var("commit_sha", data["commit_sha"], gh_out_file) add_set_output_var("default_target", os.getenv("DEFAULT_TARGET"), gh_out_file) + add_set_output_var("suffix", data["suffix"], gh_out_file) if args.type == "pull": add_env("PULL_ID", data["pull_id"], gh_env_file) add_env("PULL_NAME", data["pull_name"], gh_env_file) - add_set_output_var("pull_id", data["pull_id"], gh_out_file) - add_set_output_var("pull_name", data["pull_name"], gh_out_file) def main(): From 84ba2690a51866ee203fa725ca143c843e5bd760 Mon Sep 17 00:00:00 2001 From: Konstantin Volkov <72250702+doomwastaken@users.noreply.github.com> Date: Mon, 19 Dec 2022 21:14:44 +0300 Subject: [PATCH 2/3] GitHub: update unit_tests workflow steps to always re-flash device (#2150) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Konstantin Volkov Co-authored-by: あく --- .github/workflows/unit_tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 361b647f7..eb687b6c9 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -72,12 +72,12 @@ jobs: - name: 'Get last release tag' id: release_tag - if: success() + if: always() run: | echo "tag=$(git tag -l --sort=-version:refname | grep -v "rc\|RC" | head -1)" >> $GITHUB_OUTPUT - name: 'Decontaminate previous build leftovers' - if: success() + if: always() run: | if [ -d .git ]; then git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" @@ -85,25 +85,25 @@ jobs: - name: 'Checkout latest release' uses: actions/checkout@v3 - if: success() + if: always() with: fetch-depth: 0 ref: ${{ steps.release_tag.outputs.tag }} - name: 'Flash last release' - if: success() + if: always() run: | ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1 - name: 'Wait for flipper to finish updating' - if: success() + if: always() run: | source scripts/toolchain/fbtenv.sh python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} - name: 'Format flipper SD card' id: format - if: success() + if: always() run: | source scripts/toolchain/fbtenv.sh python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext From a81a5ca57c03cedcc03c29389540a45eeee84926 Mon Sep 17 00:00:00 2001 From: Skorpionm <85568270+Skorpionm@users.noreply.github.com> Date: Mon, 19 Dec 2022 23:22:57 +0400 Subject: [PATCH 3/3] [FL-3052] WS: add choice fahrenheit/celsius (#2149) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WS: add choice fahrenheit/celsius * WS: fix syntax Co-authored-by: あく --- .../helpers/weather_station_types.h | 2 +- .../protocols/ambient_weather.c | 4 +-- .../weather_station/protocols/infactory.c | 4 +-- .../weather_station/protocols/ws_generic.c | 4 --- .../weather_station/protocols/ws_generic.h | 3 +- .../views/weather_station_receiver_info.c | 32 +++++++++++++++---- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/applications/plugins/weather_station/helpers/weather_station_types.h b/applications/plugins/weather_station/helpers/weather_station_types.h index 16c195fa1..d512251f1 100644 --- a/applications/plugins/weather_station/helpers/weather_station_types.h +++ b/applications/plugins/weather_station/helpers/weather_station_types.h @@ -3,7 +3,7 @@ #include #include -#define WS_VERSION_APP "0.6" +#define WS_VERSION_APP "0.6.1" #define WS_DEVELOPED "SkorP" #define WS_GITHUB "https://github.com/flipperdevices/flipperzero-firmware" diff --git a/applications/plugins/weather_station/protocols/ambient_weather.c b/applications/plugins/weather_station/protocols/ambient_weather.c index 5ae22b790..e3c85f40b 100644 --- a/applications/plugins/weather_station/protocols/ambient_weather.c +++ b/applications/plugins/weather_station/protocols/ambient_weather.c @@ -134,8 +134,8 @@ static void ws_protocol_ambient_weather_remote_controller(WSBlockGeneric* instan instance->id = (instance->data >> 32) & 0xFF; instance->battery_low = (instance->data >> 31) & 1; instance->channel = ((instance->data >> 28) & 0x07) + 1; - instance->temp = ws_block_generic_fahrenheit_to_celsius( - ((float)((instance->data >> 16) & 0x0FFF) - 400.0f) / 10.0f); + instance->temp = + locale_fahrenheit_to_celsius(((float)((instance->data >> 16) & 0x0FFF) - 400.0f) / 10.0f); instance->humidity = (instance->data >> 8) & 0xFF; instance->btn = WS_NO_BTN; diff --git a/applications/plugins/weather_station/protocols/infactory.c b/applications/plugins/weather_station/protocols/infactory.c index 2d444d981..53a656d73 100644 --- a/applications/plugins/weather_station/protocols/infactory.c +++ b/applications/plugins/weather_station/protocols/infactory.c @@ -143,8 +143,8 @@ static void ws_protocol_infactory_remote_controller(WSBlockGeneric* instance) { instance->id = instance->data >> 32; instance->battery_low = (instance->data >> 26) & 1; instance->btn = WS_NO_BTN; - instance->temp = ws_block_generic_fahrenheit_to_celsius( - ((float)((instance->data >> 12) & 0x0FFF) - 900.0f) / 10.0f); + instance->temp = + locale_fahrenheit_to_celsius(((float)((instance->data >> 12) & 0x0FFF) - 900.0f) / 10.0f); instance->humidity = (((instance->data >> 8) & 0x0F) * 10) + ((instance->data >> 4) & 0x0F); // BCD, 'A0'=100%rH instance->channel = instance->data & 0x03; diff --git a/applications/plugins/weather_station/protocols/ws_generic.c b/applications/plugins/weather_station/protocols/ws_generic.c index cd5bf6557..dcacda2e4 100644 --- a/applications/plugins/weather_station/protocols/ws_generic.c +++ b/applications/plugins/weather_station/protocols/ws_generic.c @@ -209,7 +209,3 @@ bool ws_block_generic_deserialize(WSBlockGeneric* instance, FlipperFormat* flipp return res; } - -float ws_block_generic_fahrenheit_to_celsius(float fahrenheit) { - return (fahrenheit - 32.0f) / 1.8f; -} \ No newline at end of file diff --git a/applications/plugins/weather_station/protocols/ws_generic.h b/applications/plugins/weather_station/protocols/ws_generic.h index 657f8a1fc..8e6e061ad 100644 --- a/applications/plugins/weather_station/protocols/ws_generic.h +++ b/applications/plugins/weather_station/protocols/ws_generic.h @@ -8,6 +8,7 @@ #include "furi.h" #include "furi_hal.h" #include +#include #ifdef __cplusplus extern "C" { @@ -62,8 +63,6 @@ bool ws_block_generic_serialize( */ bool ws_block_generic_deserialize(WSBlockGeneric* instance, FlipperFormat* flipper_format); -float ws_block_generic_fahrenheit_to_celsius(float fahrenheit); - #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/applications/plugins/weather_station/views/weather_station_receiver_info.c b/applications/plugins/weather_station/views/weather_station_receiver_info.c index 058099217..55d239aad 100644 --- a/applications/plugins/weather_station/views/weather_station_receiver_info.c +++ b/applications/plugins/weather_station/views/weather_station_receiver_info.c @@ -81,13 +81,33 @@ void ws_view_receiver_info_draw(Canvas* canvas, WSReceiverInfoModel* model) { if(model->generic->temp != WS_NO_TEMPERATURE) { canvas_draw_icon(canvas, 6, 43, &I_Therm_7x16); - snprintf(buffer, sizeof(buffer), "%3.1f C", (double)model->generic->temp); - uint8_t temp_x1 = 47; - uint8_t temp_x2 = 38; - if(model->generic->temp < -9.0) { - temp_x1 = 49; - temp_x2 = 40; + + uint8_t temp_x1 = 0; + uint8_t temp_x2 = 0; + if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) { + snprintf(buffer, sizeof(buffer), "%3.1f C", (double)model->generic->temp); + if(model->generic->temp < -9.0f) { + temp_x1 = 49; + temp_x2 = 40; + } else { + temp_x1 = 47; + temp_x2 = 38; + } + } else { + snprintf( + buffer, + sizeof(buffer), + "%3.1f F", + (double)locale_celsius_to_fahrenheit(model->generic->temp)); + if((model->generic->temp < -27.77f) || (model->generic->temp > 37.77f)) { + temp_x1 = 50; + temp_x2 = 42; + } else { + temp_x1 = 48; + temp_x2 = 40; + } } + canvas_draw_str_aligned(canvas, temp_x1, 47, AlignRight, AlignTop, buffer); canvas_draw_circle(canvas, temp_x2, 46, 1); }