Skip to content

Commit

Permalink
Increment version numbers, bundle new firmware with Android app, and …
Browse files Browse the repository at this point in the history
…cherry-pick a small fix that the third party flashing library made to improve success rates.
  • Loading branch information
VanceVagell committed Dec 25, 2024
1 parent f40b689 commit 490810d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions android-src/KV4PHT/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.vagell.kv4pht"
minSdk 26
targetSdk 34
versionCode 22
versionName "1.4.0"
versionCode 23
versionName "1.5.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public class FirmwareUtils {
private static int progressPercent = 0;

// Whenever there is new firmware, put the files in res/raw, and update these constants.
public static final int PACKAGED_FIRMWARE_VER = 3;
private static final int FIRMWARE_FILE_1_ID = R.raw.v3_kv4p_ht_esp32_wroom_32_ino_bootloader;
private static final int FIRMWARE_FILE_2_ID = R.raw.v3_kv4p_ht_esp32_wroom_32_ino_partitions;
public static final int PACKAGED_FIRMWARE_VER = 4;
private static final int FIRMWARE_FILE_1_ID = R.raw.v4_kv4p_ht_esp32_wroom_32_ino_bootloader;
private static final int FIRMWARE_FILE_2_ID = R.raw.v4_kv4p_ht_esp32_wroom_32_ino_partitions;
private static final int FIRMWARE_FILE_3_ID = R.raw.boot_app0; // This one never changes, it's the Arduino ESP32 bootloader
private static final int FIRMWARE_FILE_4_ID = R.raw.v3_kv4p_ht_esp32_wroom_32_ino;
private static final int FIRMWARE_FILE_4_ID = R.raw.v4_kv4p_ht_esp32_wroom_32_ino;

public FirmwareUtils() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,15 +509,13 @@ public void enterBootLoader() {
* @name flash_defl_block Send one compressed block of data to program into SPI Flash memory
*/

public void flash_defl_block(byte data[], int seq, int timeout) {

public cmdRet flash_defl_block(byte data[], int seq, int timeout) {
byte pkt[] = _appendArray(_int_to_bytearray(data.length),_int_to_bytearray(seq));
pkt = _appendArray(pkt,_int_to_bytearray(0));
pkt = _appendArray(pkt,_int_to_bytearray(0));
pkt = _appendArray(pkt, data);

sendCommand((byte) ESP_FLASH_DEFL_DATA, pkt, _checksum(data), timeout);

return sendCommand((byte) ESP_FLASH_DEFL_DATA, pkt, _checksum(data), timeout);
}

public void init() {
Expand Down Expand Up @@ -589,7 +587,12 @@ public void flashData(byte binaryData[], int offset, int part) {
block = _appendArray(block, tempArray);*/
}

flash_defl_block(block, seq, FLASH_TIMEOUT_MS);
cmdRet retVal = flash_defl_block(block, seq, FLASH_TIMEOUT_MS);
if (retVal.retCode ==-1) {
//This should fix issue when writing is incorrect by trying again
mUpCallback.onInfo("Retry because Ret code:" + retVal.retCode +"\n");
retVal = flash_defl_block(block, seq, FLASH_TIMEOUT_MS);
}
seq += 1;
written += block.length;
position += (IS_STUB ? STUBLOADER_FLASH_WRITE_SIZE : FLASH_WRITE_SIZE);
Expand Down
Binary file not shown.

0 comments on commit 490810d

Please sign in to comment.