Giter Site home page Giter Site logo

radomir9720 / pixel_app_flutter Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 1.0 9.82 MB

Application, which manages the functions of the car. Also considered to be used as an on-board computer.

License: GNU General Public License v3.0

Kotlin 0.01% Swift 0.21% Objective-C 0.01% Dart 96.66% HTML 0.34% CMake 0.82% C++ 1.54% C 0.06% Ruby 0.24% Shell 0.11%

pixel_app_flutter's Introduction

Pixel App Flutter

style: very good analysis License: GPL 3.0

Navigation

About


This project is an application written using Dart and Flutter for an ambitious open source project called StarPixel.

StarPixel is conceived as an electric car that absolutely anyone can build, using opensource information like drawings and software.

The main purpose of this application is to manage the functions of the car. it is also considered to be used as an on-board computer.

As the main hardware was choosen esp32. The software for esp32(called MainECU) lives here. The MainECU is the connecting link between this application and car interfaces.

Click here to open the design project in figma.

What is currently implemented


  • USB, Bluetooth, and Demo data sources

    Below is the table with data source support for each platform at the present moment.

    DataSource Android iOS Windows MacOS Linux Web
    Bluetooth ✔️ ✖️ ✖️ ✔️ ✖️
    USB ✔️ ✖️ ✔️ ✔️ ✖️
    WIFI ✖️ ✖️ ✖️ ✖️ ✖️ ✖️
    HTTP ✖️ ✖️ ✖️ ✖️ ✖️ ✖️
    Demo ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
    • USB Data Source

      The ability to connect to MainECU(eps32) using CH34X and ATMega16u2 USB to TTL adapters. Connection was tested on Android, MacOS and Windows, but, theoretically, it should also work on Linux. On iOS this connection type is not available because of MFI Program.

    • Bluetooth Data Source

      For now, bluetooth connection with an esp32 device works only on Android and MacOS. On iOS connection via Bluetooth is not availalbe because we use esp32 devices with Bluetooth Classic(under v4.0). Apple does not allow to use Bluetooth Classic if the device is not registered with the MFI Program. There are also esp32 devices with BLE(bluetooth version >=4.0), so if we will decide to replace Bluetooth Classic esp32 devices with Low Energy ones, we will have the oportunity to implement bluetooth connection also on iOS

    • Demo Data Source

      The purpose is to connect to a mocked service like to a real one. It generates random values(like speed and voltage). This way you can, for example, work on UI, or just have a look at all the app's functions, without the need to connect to a real device(maybe you don't have it at all).


  • User defined buttons

    User can add his own buttons, which will send to and/or receive from the L2 level certain data.

    For now 4 types of buttons are available:

    1. Simple button - just sends certain data by tapping.
    2. Indicator - subscribes and listens for certain data from the L2, and displays a color and/or a status according to the data.
      Example of use: displaying the batery temperature(ok, warning, critical)
    3. Y-axis joystick - sends drag/pan data to the L2 level in the range from -100 to 100. Also has an optional "on tap" handler, which means that certain data can be sent to the L2 when the joystick is just pressed(no drag/pan).
      Example of use: window lifter.
    4. X-axis joystick - sends drag/pan data to the L2 level in the range from -100 to 100. Also has an optional "on tap" handler, which means that certain data can be sent to the L2 when the joystick is just pressed(no drag/pan).
      Example of use: seat regulator.

  • Responsive UI

  • Localization

    Currently english and russian.

  • Flavors(generated by the Very Good CLI)

    Development, staging and production.

  • Developer Tools

    A set of parameters and settings, which are useful in the process of development. Developer tools are available only on development flavor

  • Firebase

    Analytics and Crashlytics

  • Launcher(for android)

    On android there is an option to choose the application as the default laucher. That way you can have an android device specially to use it as on-board computer

What should be implemented


  • Other connection options

    Via WIFI, and HTTP

  • Bluetooth connection on iOS

    The reason why it's not implemented for now is in the What is currently implemented section

How can i contribute?


If you want to work constantly on this project please read the general regulations. Also there you will find instructions on how to join the team. Here is the StarPixel discord server.

How to lauch the project


This project currently runs on Android, iOS, and MacOS. For other platforms it may require some setup. Therefore, below will be instructions on how to lauch this project on these platforms.

Of course, you should have installed Dart and Flutter. If you haven't done this yet, please take a look at the documentation.

To launch the project you also should paste required firebase related files(google-services.json for android, and GoogleService-Info.plist with firebase_app_id_file.json for iOS and MacOS).

If you want to contribute and work constantly on this project, you can contact me, i will give you access to the firebase project. Otherwise you can just create your own firebase project and download firebase related files. Also note that this project contains 3 flavors, and for each flavor was created an app on firebase. For android there is no big difference, because configurations for all these projects are inside one file, while for iOS you should have three different files GoogleService-Info.plist and also three different files firebase_app_id_file.json(one for each flavor). MacOS does not support flavors, therefore for MacOS you need only one file GoogleService-Info.plist and one file firebase_app_id_file.json.

For android you need to put the google-services.json file in the android/app directory, so the full path should be android/app/google-services.json.

For iOS you should prepare three different files GoogleService-Info.plist and three different files firebase_app_id_file.json(one for each flavor: for production, staging, and development). Then you need to put these files respectively in directories ios/config/development/, ios/config/staging/, and ios/config/production/. So in the end you should have the following structure:

ios/
    config/
        development/
            firebase_app_id_file.json
            GoogleService-Info.plist
        staging/
            firebase_app_id_file.json
            GoogleService-Info.plist
        production/
            firebase_app_id_file.json
            GoogleService-Info.plist

For iOS you need to put the GoogleService-Info.plist file in the macos/Runner/ directory, so the full path should be macos/Runner/GoogleService-Info.plist and the firebase_app_id_file.json file in the macos/ directory, so the full path should be macos/firebase_app_id_file.json.

This project contains 3 flavors:

  • development
  • staging
  • production

To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands:

# Development
$ flutter run --flavor development --target lib/main_development.dart

# Staging
$ flutter run --flavor staging --target lib/main_staging.dart

# Production
$ flutter run --flavor production --target lib/main_production.dart

Again, if you want to lauch the app on MacOS, the commands above won't work, because MacOS does not support flavors. If you are using VSCode you can use lauch configurations with the [No flavor] suffix. Or, if you want to use commands, you can use the commands above, just remove the flavor option(for example: flutter run --target lib/main_development.dart)


Running Tests 🧪

To run all unit and widget tests use the following command:

$ flutter test --coverage --test-randomize-ordering-seed random

To view the generated coverage report you can use lcov.

# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
$ open coverage/index.html

pixel_app_flutter's People

Contributors

radomir9720 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

vovaklh

pixel_app_flutter's Issues

Change handshake logic

Никто не подключён, начальное состояние. Приложение = Androind, Устройство = MaineECU.

  1. Приложение подключается, и отправляет type=0x10 id=0x0000.
  2. Устройство получив этот запрос отвечает type=0x10 id=0x0000. ( Потом на этом этапе будет авторизация )
  3. Потом на этом этапе будут другие type=0x10 id=хххх, которые будут вычитывает базовую инфу о машине.
    Всё, соединение установлено. Оба устройства молчат.

При бездействии в 1 секунду, Устройство генерирует запрос пинга (на предмет наличия чего-либо на BT, на зависшее приложение и так далее):

  1. Устройство шлёт type=0x10 id=0xFFFF.
  2. Приложение как только получит его, сразу отвечает type=0x10 id=0xFFFF. Тем самым говоря Устройству что соединение активное.
    Бездействие это отсутствие любого валидного входящего пакета со стороны Приложения.

Удобство фильтра

Лог обмена >> Фильтр. Все параметры отображаются как цифры, но везде у нас используются HEX. Приходится переводить вручную.

Ошибка при создании пользовательской кнопки

При добавлении пользовательской кнопки или индикатора в обязательных полях указано null и рядом есть корзина.

  1. Можно убрать Null?
  2. Если нажать на корзину а потом добавить пакет, то при сохранении появляется ""Ошибка при добавлении кнопки""

Визуальный баг

При добавлении пользовательской кнопки или индикатора, кнопка сохранить скрывается клавиатурой.

Баг плавающего окна

Если включить "Окно статистики поверх других приложений", а потом попытаться отключить, то будет ошибка "Разрешения не было предоставлено", хотя разрешение есть и окно отображается.

Перемещение ошибок

Появилось предложение переместить отображаемые ошибки с нижней панели в скрытое окно, наподобие окна пользовательских кнопок.
При появлении ошибки, на экране загорается кнопка с восклицательным знаком, возможно со сверхзвуковым представлением. При клике открывается панелька со списком всех ошибок в хронологическом порядке. Каждую ошибку можно удалить, или очистить весь список сразу.
При клике на конкретную ошибку, появляется подробная информация о неё, пакеты запроса, ответа и прочая тех. информация.
Когда все ошибки были удалены, кнопка скрывается, или становиться серой, не активной.

Баг дверей

При попытки открыть любую дверь, пакет уходит, приходит ответ но через некоторое время появляется ошибка о неудачном переключении.
Вероятнее всего ожидается что дверь должна быть открыта, но это не корректно. По кнопке открывается замок, но дверь может и не открыться, например уперлась в стену. Пакеты общения:

+L3_OnRX        Type: 0x15, Param: 0x0187, Data(1): 0x03;
+L2_OnRX        addr: 0x0187, len: 1, data: 0x65;

Данное общение говорит нам о том, что замок 'принял команду к сведению' и это является успешным выполнение команды: Плата в сети и устройство выполнило команду.
Сам индикатор должен реагировать на пакет:

+L2_OnRX        addr: 0x0130, len: 2, data: 0x65, 0xFF;
+L2_OnRX        addr: 0x0130, len: 2, data: 0x65, 0x00;

И это происходит корректно.

Баг джойстика

Если дёрнуть джойстик и поиграть с нажатием, начинается флуд одинакового значения, даже если отпустить стик полностью.
Пока не выяснил до конца происходящее.

Отсутствие текущего состояния в MainECU при подписке

Если по устройству ДО подключения телефона не было ни единого пакета общения, или в процессе Main перезагрузился, то на подписку возвращается пакет с пустым полем данных.
Нужно придумать что делать в такой ситуации. Варианты:

  1. Main при получении пакета подписки проверяет, если ли у него состояние, если нет, то возвращает код ошибки ""Идёт запрос"" и делает запрос состояния из CAN, после чего телефон его получит через событие: ( request >> event ok ).
  2. Телефон получает ошибку (данные не известны) и самостоятельно делает запрос данных: ( request >> event ok ).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.