diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5e8c227c2..21d321c60 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -3,17 +3,7 @@ name: Build on: pull_request: branches: ["flutter"] - paths-ignore: - - '**.md' - - 'docs/**' - - '**.png' - - '**.jpg' - - '**.jpeg' - - '**.gif' - - '**.svg' - - '**.webp' - - '**.txt' - - '**.arb' + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -25,138 +15,229 @@ env: IPAD_DEVICE_MODEL: iPad Pro 13-inch (M4) jobs: + changes: + name: Detect Changes + runs-on: ubuntu-latest + outputs: + is_code: ${{ steps.check.outputs.is_code }} + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - id: check + run: | + # Diff the actual commit SHAs. + # grep -vE removes your media/doc extensions. grep -v removes the docs folder. + # If anything is left over, it's code. If the output is empty, it's just docs. + if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -vE '\.(md|png|jpg|jpeg|gif|svg|webp|txt|arb)$' | grep -v '^docs/'; then + echo "is_code=true" >> $GITHUB_OUTPUT + else + echo "is_code=false" >> $GITHUB_OUTPUT + fi + common: name: Common Build + needs: changes runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: Common Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/common - name: Save PR number + if: needs.changes.outputs.is_code == 'true' run: | mkdir -p ./pr echo ${{ github.event.number }} > ./pr/NR - uses: actions/upload-artifact@v7 + if: needs.changes.outputs.is_code == 'true' with: name: pr path: pr/ + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + android: name: Android Flutter Build - needs: common + needs: [changes, common] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: Android Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/android + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + ios: name: iOS Flutter Build - needs: common - runs-on: macos-latest + needs: [changes, common] + runs-on: ${{ needs.changes.outputs.is_code == 'true' && 'macos-latest' || 'ubuntu-latest' }} steps: - name: Set up Xcode + if: needs.changes.outputs.is_code == 'true' uses: maxim-lobanov/setup-xcode@v1.7.0 with: xcode-version: '16.4.0' - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: iOS Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/ios + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + screenshots-android: name: Screenshots (Android) + needs: changes runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: Android Screenshot Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/screenshot-android with: ANDROID_EMULATOR_API: ${{ env.ANDROID_EMULATOR_API }} ANDROID_EMULATOR_ARCH: ${{ env.ANDROID_EMULATOR_ARCH }} + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + screenshots-iphone: name: Screenshots (iPhone) - runs-on: macos-latest + needs: changes + runs-on: ${{ needs.changes.outputs.is_code == 'true' && 'macos-latest' || 'ubuntu-latest' }} timeout-minutes: 30 steps: - name: Set up Xcode + if: needs.changes.outputs.is_code == 'true' uses: maxim-lobanov/setup-xcode@v1.7.0 with: xcode-version: '16.4.0' - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: iPhone Screenshot Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/screenshot-iphone with: IPHONE_DEVICE_MODEL: ${{ env.IPHONE_DEVICE_MODEL }} - + + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + screenshots-ipad: name: Screenshots (iPad) - runs-on: macos-latest + needs: changes + runs-on: ${{ needs.changes.outputs.is_code == 'true' && 'macos-latest' || 'ubuntu-latest' }} timeout-minutes: 30 steps: - name: Set up Xcode + if: needs.changes.outputs.is_code == 'true' uses: maxim-lobanov/setup-xcode@v1.7.0 with: xcode-version: '16.4.0' - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: iPad Screenshot Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/screenshot-ipad with: IPAD_DEVICE_MODEL: ${{ env.IPAD_DEVICE_MODEL }} - + + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + windows: name: Windows Flutter Build - needs: common - runs-on: windows-latest + needs: [changes, common] + runs-on: ${{ needs.changes.outputs.is_code == 'true' && 'windows-latest' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: Windows Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/windows - + + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + linux: name: Linux Flutter Build - needs: common + needs: [changes, common] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: Linux Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/linux + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + linux-arm64: name: Linux ARM64 Flutter Build - needs: common - runs-on: ubuntu-24.04-arm + needs: [changes, common] + runs-on: ${{ needs.changes.outputs.is_code == 'true' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: Linux ARM64 Workflow + if: needs.changes.outputs.is_code == 'true' uses: ./.github/actions/linux-arm64 + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." + macos: name: macOS Flutter Build - needs: common - runs-on: macos-latest + needs: [changes, common] + runs-on: ${{ needs.changes.outputs.is_code == 'true' && 'macos-latest' || 'ubuntu-latest' }} steps: - name: Set up Xcode + if: needs.changes.outputs.is_code == 'true' uses: maxim-lobanov/setup-xcode@v1.7.0 with: xcode-version: '16.4.0' - uses: actions/checkout@v6 + if: needs.changes.outputs.is_code == 'true' - name: macOS Workflow - uses: ./.github/actions/macos \ No newline at end of file + if: needs.changes.outputs.is_code == 'true' + uses: ./.github/actions/macos + + - name: Non-Code Change + if: needs.changes.outputs.is_code != 'true' + run: echo "Non-code change detected." diff --git a/README.md b/README.md index 040d7f499..9d66164b2 100644 --- a/README.md +++ b/README.md @@ -506,6 +506,9 @@ Despite any reason, follow the steps given below to squash all commits into one `$ git push -f origin ` +////////// + + ### Branch Policy We have the following branches diff --git a/docs/Lux meter.md b/docs/Lux meter.md index 1079a56f1..8e9d5b047 100644 --- a/docs/Lux meter.md +++ b/docs/Lux meter.md @@ -1,6 +1,6 @@ # How to use Lux meter -## Table of Content +## Table of Contents 1. Introduction 2. Layout 3. Features @@ -9,7 +9,7 @@ 4. How to Use ## Introduction -Pocket Science Lab contains a lux meter which can measure real time ambient light intensity. This lux meter can use either the `built-in ambient light sensor` in your android device, `BH-1750` or `TSL-2561` lux sensors. The PSLab android application communicates with the Pocket Science Lab using `I2C` bus to read the two externally connected sensors. This document will help a user on available functionalities and how to use Pocket Science Lab with PSLab android application. +Pocket Science Lab contains a lux meter which can measure real time ambient light intensity. This lux meter can use either the `built-in ambient light sensor` in your android device, `BH-1750` or `TSL-2561` lux sensors. The PSLab android application communicates with the Pocket Science Lab using `I2C` bus to read the two externally connected sensors. This document will help a user on available functionalities and how to use Pocket Science Lab with PSLab application. ## Layout @@ -47,7 +47,7 @@ Configure view is used to control the lux meter by changing variuos parameters. 4. Update period - The time delay between two successive sensor readings can be changed by this parameter. The range is from `100ms` to `1000ms`. -## How to Use +## How to Use it The default sensor for the lux meter is the built-in sensor. If the android device contains the ambient light sensor, immediatly the data can be observed throught the data view. When using a I2C connected lux sensor, the pin configuration for the sensor is as follows. @@ -63,4 +63,4 @@ SDA | SDA The pin configuration for the TSL-2561 is also as same as above. -Change the parameters `update period`, `high limit` and `gain range` and observe the differences. \ No newline at end of file +Change the parameters `update period`, `high limit` and `gain range` and observe the differences. diff --git a/lib/communication/science_lab.dart b/lib/communication/science_lab.dart index a926dc3ee..04119ab86 100644 --- a/lib/communication/science_lab.dart +++ b/lib/communication/science_lab.dart @@ -57,7 +57,7 @@ class ScienceLab { if (isDeviceFound()) { try { await mCommunicationHandler.open(); - mPacketHandler = PacketHandler(500, mCommunicationHandler); + mPacketHandler = PacketHandler(1500, mCommunicationHandler); } catch (e) { logger.e(e); } diff --git a/lib/providers/settings_config_provider.dart b/lib/providers/settings_config_provider.dart index 90f4a8252..57bed6281 100644 --- a/lib/providers/settings_config_provider.dart +++ b/lib/providers/settings_config_provider.dart @@ -36,7 +36,7 @@ class SettingsConfigProvider extends ChangeNotifier { await prefs.setString('settings_config', json.encode(_config.toJson())); logger.d("Saved SettingsConfig: ${_config.toJson()}"); } catch (e) { - logger.e("Error saving SettingsConfig to prefs: $e"); + logger.e("EError saving SettingsConfig to prefs: $e"); } } diff --git a/lib/providers/wave_generator_state_provider.dart b/lib/providers/wave_generator_state_provider.dart index 41d3aba4f..b2ef1b545 100644 --- a/lib/providers/wave_generator_state_provider.dart +++ b/lib/providers/wave_generator_state_provider.dart @@ -34,7 +34,7 @@ enum WaveConst { enum WaveData { freqMin(10), - dutyMin(0), + dutyMin(10), phaseMin(0), freqMax(5000), phaseMax(360), diff --git a/lib/view/barometer_screen.dart b/lib/view/barometer_screen.dart index 4b734d499..1373f56ed 100644 --- a/lib/view/barometer_screen.dart +++ b/lib/view/barometer_screen.dart @@ -77,7 +77,7 @@ class _BarometerScreenState extends State { _i2c = I2C(_scienceLab!.mPacketHandler); } } catch (e) { - logger.e('Error initializing ScienceLab: $e'); + logger.e('Error initializing _____ScienceLab_____: $e'); } } diff --git a/lib/view/gyroscope_screen.dart b/lib/view/gyroscope_screen.dart index 8f4c211df..65dbaa058 100644 --- a/lib/view/gyroscope_screen.dart +++ b/lib/view/gyroscope_screen.dart @@ -77,7 +77,7 @@ class _GyroscopeScreenState extends State { ), const InstrumentImage( imagePath: imagePath, - height: 200.0, + height: 210.0, ), InstrumentIntroText( text: appLocalizations.gyroscopeDesc, diff --git a/pubspec.yaml b/pubspec.yaml index a1dda0b13..c2179f15f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ version: 1.0.0+1 environment: sdk: ^3.5.4 - flutter: '3.41.6' + flutter: '3.41.9' dependencies: flutter: