Don't include firmware in development builds (speeds install time)

This commit is contained in:
geeksville 2020-06-28 14:55:02 -07:00
parent c7c89aeb71
commit 40055f603d
9 changed files with 71 additions and 4 deletions

View file

@ -1442,7 +1442,7 @@ class MeshService : Service(), Logging {
/***
* Return the filename we will install on the device
*/
fun setFirmwareUpdateFilename(info: MeshProtos.MyNodeInfo) {
private fun setFirmwareUpdateFilename(info: MeshProtos.MyNodeInfo) {
firmwareUpdateFilename = try {
if (info.region != null && info.firmwareVersion != null && info.hwModel != null)
SoftwareUpdateService.getUpdateFilename(

View file

@ -219,7 +219,7 @@ class SoftwareUpdateService : JobIntentService(), Logging {
hwVerIn: String,
swVer: String,
mfg: String
): String {
): String? {
val curver = context.getString(R.string.cur_firmware_version)
val regionRegex = Regex(".+-(.+)")
@ -230,7 +230,12 @@ class SoftwareUpdateService : JobIntentService(), Logging {
val (region) = regionRegex.find(hwVer)?.destructured
?: throw Exception("Malformed hw version")
return "firmware/firmware-$mfg-$region-$curver.bin"
val name = "firmware/firmware-$mfg-$region-$curver.bin"
// Check to see if the file exists (some builds might not include update files for size reasons)
return if (!context.assets.list(name).isNullOrEmpty())
name
else
null
}
/** Return the filename this device needs to use as an update (or null if no update needed)