Progress Bar Monitor

This code can be run by any thread that’s not currently busy calling the FlashPro-M or GangPro-M library. The condition for this example to work properly is that F_OpenInstancesAndFPAs, and F_Initialization has correctly initialized the given fpa index (1 to 64) given as a parameter to this function.

void UpdateProgress(BYTE fpa, INT_X &progValue, INT_X &lastOpCode, CString &opCodeUpdate) { if(fpa == 0) { //invalid index return; } progValue = F_GetProgressBar(fpa); lastOpCode = F_GetLastOpCode(fpa); opCodeUpdate = "Unknown"; switch(lastOpCode) { case PROG_OPCODE_VERIFY_ACCESS: opCodeUpdate = "Verify Access To MCU"; break; case PROG_OPCODE_FLASH_ERASE: opCodeUpdate = "Flash Erase"; break; case PROG_OPCODE_FLASH_BLANK_CHECK: opCodeUpdate = "Flash Blank Check"; break; case PROG_OPCODE_FLASH_SELECTED_BLANK_CHECK: opCodeUpdate = "Selected Memory Blank Check"; break; case PROG_OPCODE_FLASH_WRITE: opCodeUpdate = "Flash Write"; break; case PROG_OPCODE_FLASH_VERIFY: opCodeUpdate = "Flash Verify"; break; case PROG_OPCODE_FLASH_READ: opCodeUpdate = "Flash Read"; break; case PROG_OPCODE_LOCK_MCU: opCodeUpdate = "Lock MCU"; break; case PROG_OPCODE_UNLOCK_MCU: opCodeUpdate = "Unlock MCU"; break; case PROG_OPCODE_START_APP: opCodeUpdate = "Start Application"; break; } }

This code updates the progress bar and operation name string at the bottom of this demo; in the screenshot the operation name is “Flash Verify” and progress is 100 meaning the function has finished: