Skip to content

Commit c0be197

Browse files
committed
Upload firmware functions and new UI
1 parent 66554e2 commit c0be197

File tree

97 files changed

+2304
-2763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2304
-2763
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ This is a Kotlin Multiplatform project targeting Android, iOS, Desktop.
3636

3737

3838
Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)
39+
Firmware Flasher thanks to https://github.com/xCarlost/esptool-android

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle.kts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
plugins {
2+
id("com.android.application")
3+
id("org.jetbrains.kotlin.android")
4+
}
5+
6+
android {
7+
namespace = "bruce.app"
8+
compileSdk = 34
9+
10+
defaultConfig {
11+
applicationId = "bruce.app"
12+
minSdk = 27
13+
targetSdk = 34
14+
versionCode = 1
15+
versionName = "1.0"
16+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
17+
vectorDrawables {
18+
useSupportLibrary = true
19+
}
20+
21+
}
22+
23+
buildTypes {
24+
release {
25+
isMinifyEnabled = false
26+
proguardFiles(
27+
getDefaultProguardFile("proguard-android-optimize.txt"),
28+
"proguard-rules.pro"
29+
)
30+
}
31+
}
32+
33+
lint {
34+
checkReleaseBuilds = false
35+
abortOnError = false
36+
}
37+
38+
kotlinOptions {
39+
jvmTarget = "1.8"
40+
freeCompilerArgs += "-Xuse-ir"
41+
}
42+
buildFeatures {
43+
compose = true
44+
}
45+
packaging {
46+
resources {
47+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
48+
}
49+
}
50+
}
51+
52+
dependencies {
53+
implementation(libs.androidx.core.ktx)
54+
implementation(libs.androidx.lifecycle.runtime.ktx)
55+
implementation(libs.androidx.activity.compose)
56+
implementation(platform(libs.androidx.compose.bom))
57+
implementation(libs.androidx.ui)
58+
implementation(libs.androidx.ui.graphics)
59+
implementation(libs.androidx.ui.tooling.preview)
60+
implementation(libs.androidx.material3)
61+
implementation(libs.usbserialforandroid)
62+
implementation(project(":esptool-android"))
63+
64+
// Coroutines for async operations
65+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
66+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

app/src/main/AndroidManifest.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<!-- Permissions for USB access -->
6+
<uses-permission android:name="android.permission.USB_PERMISSION" />
7+
8+
<!-- Internet permission for WebView -->
9+
<uses-permission android:name="android.permission.INTERNET" />
10+
11+
<!-- Storage permissions for file access -->
12+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
13+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
14+
android:maxSdkVersion="28" />
15+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
16+
tools:ignore="ScopedStorage" />
17+
18+
<!-- Declare that the app uses USB features -->
19+
<uses-feature android:name="android.hardware.usb.host" />
20+
21+
<application
22+
android:name="com.chaquo.python.android.PyApplication"
23+
android:allowBackup="true"
24+
android:dataExtractionRules="@xml/data_extraction_rules"
25+
android:fullBackupContent="@xml/backup_rules"
26+
android:icon="@mipmap/ic_launcher"
27+
android:label="@string/app_name"
28+
android:roundIcon="@mipmap/ic_launcher_round"
29+
android:supportsRtl="true"
30+
android:theme="@style/Theme.FirmwareFlasher"
31+
android:usesCleartextTraffic="true"
32+
tools:targetApi="34">
33+
34+
<activity
35+
android:name="bruce.app.MainActivity"
36+
android:exported="true"
37+
android:theme="@style/Theme.FirmwareFlasher">
38+
<intent-filter>
39+
<action android:name="android.intent.action.MAIN" />
40+
<category android:name="android.intent.category.LAUNCHER" />
41+
</intent-filter>
42+
43+
<intent-filter>
44+
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
45+
</intent-filter>
46+
47+
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
48+
android:resource="@xml/device_filter" />
49+
50+
</activity>
51+
</application>
52+
53+
</manifest>
54+
55+
261 KB
Binary file not shown.
255 KB
Binary file not shown.
File renamed without changes.

composeApp/src/androidMain/kotlin/bruce/app/AndroidSerialCommunication.kt renamed to app/src/main/java/bruce/app/AndroidSerialCommunication.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import java.nio.ByteBuffer
1515
class AndroidSerialCommunication(private val context: Context) : SerialCommunication {
1616
companion object {
1717
private const val TAG = "SerialComm"
18-
private const val DEFAULT_BAUDRATE = 9600
18+
private const val DEFAULT_BAUDRATE = 115200
1919
}
2020

2121
private val usbManager: UsbManager = context.getSystemService(Context.USB_SERVICE) as UsbManager
@@ -110,7 +110,7 @@ class AndroidSerialCommunication(private val context: Context) : SerialCommunica
110110
}
111111

112112
override fun connect() {
113-
notifyOutput("\n=== Starting USB Connection ===")
113+
notifyOutput("\n=== Starting USB Serial Connection ===")
114114

115115
try {
116116
setupUsbPermission()
@@ -411,7 +411,3 @@ class AndroidSerialCommunication(private val context: Context) : SerialCommunica
411411
}
412412
}
413413
}
414-
415-
actual fun getSerialCommunication(): SerialCommunication {
416-
return AndroidSerialCommunication(MainActivity.instance)
417-
}

0 commit comments

Comments
 (0)