Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions public/mcm-81339-v0-28-0.bin

This file was deleted.

3 changes: 3 additions & 0 deletions public/mcm-81339-v0-29-0.bin
Git LFS file not shown
3 changes: 0 additions & 3 deletions public/mcm-81349-v0-28-0.bin

This file was deleted.

3 changes: 3 additions & 0 deletions public/mcm-81349-v0-29-0.bin
Git LFS file not shown
15 changes: 11 additions & 4 deletions src/js/usbMcmLin.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { McmGeneric } from './usbMcmGeneric';
import { convertUint16ToUint8Array, convertUint32ToUint8Array, MasterMode, mcmMlxMessageId, mcmVendorRequest } from './usbTransport';

const MEMORY_FLASH = 1;
const MEMORY_NVRAM = 0;

const BTL_MEMORY = {
nvram: 0,
flash: 1,
flash_cs: 2,
};
const OPP_PROGRAM = 0;
const OPP_VERIFY = 1;

Expand Down Expand Up @@ -37,14 +39,19 @@ export class McmLin extends McmGeneric {
await this.disableLinMode();
}

const memType = BTL_MEMORY[memory.toLowerCase()];
if (memType === undefined) {
throw new Error(`Unknown memory type: "${memory}". Valid types: ${Object.keys(BTL_MEMORY).join(', ')}`);
}

// transfer hex file
await this.transport.doHexfileTransfer(hexfile);

const payload = new Uint8Array(8);
payload.set(convertUint32ToUint8Array(bitRate), 0); // baudrate to be used during bootloader operations
payload[4] = manualPower ? 1 : 0; // 1: manual power cycling
payload[5] = broadcast ? 1 : 0; // 1: bootloading shall be done in broadcast mode
payload[6] = memory.toLowerCase() === 'flash' ? MEMORY_FLASH : MEMORY_NVRAM; // memory type to perform action on (0: NVRAM; 1: flash)
payload[6] = memType; // memory type to perform action on (0: NVRAM; 1: flash; 2=flash_cs)
payload[7] = operation.toLowerCase() === 'program' ? OPP_PROGRAM : OPP_VERIFY; // action type to perform (0: program; 1: verify)

try {
Expand Down
25 changes: 19 additions & 6 deletions src/views/pwm/PwmController.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const mcm = new McmPwm(transport);

const errorMsg = ref('');
const isErrorMsg = ref(false);
let errorCount = 0;
const ERROR_DISPLAY_POLLS = 10; /* 10 × 250 ms = 2.5 s */

const pwmFrequency = ref(1000);
const pwmDutyCycle = ref(0);
Expand All @@ -34,6 +36,7 @@ onMounted(async () => {
} catch (error) {
isErrorMsg.value = true;
errorMsg.value = error.message;
errorCount = ERROR_DISPLAY_POLLS;
}
});

Expand All @@ -51,6 +54,7 @@ async function updateDutyCycle () {
} catch (error) {
isErrorMsg.value = true;
errorMsg.value = error.message;
errorCount = ERROR_DISPLAY_POLLS;
}
}

Expand All @@ -60,6 +64,7 @@ async function updateFrequency () {
} catch (error) {
isErrorMsg.value = true;
errorMsg.value = error.message;
errorCount = ERROR_DISPLAY_POLLS;
}
}

Expand All @@ -82,6 +87,14 @@ async function updateStatus () {
} catch {
/* silent polling error (optional) */
}

if (errorCount > 0) {
errorCount -= 1;
if (errorCount === 0) {
isErrorMsg.value = false;
errorMsg.value = '';
}
}
}
</script>

Expand Down Expand Up @@ -163,12 +176,6 @@ async function updateStatus () {
Live Status
</h5>

<StatusMessage
:is-error="isErrorMsg"
:message="errorMsg"
class="mb-3"
/>

<div class="status-grid">
<div class="status-label">
PWM Frequency
Expand All @@ -191,6 +198,12 @@ async function updateStatus () {
{{ pwmStatFgFrequency ?? '--' }} Hz
</div>
</div>

<StatusMessage
:is-error="isErrorMsg"
:message="errorMsg"
class="mb-3"
/>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/views/system/SystemUpgrade.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const firmwareBaseNames = {
'Melexis Compact Master LIN': 'mcm-lin',
};
const firmwareLatestRev = {
'mcm-81339': 'v0.28.0',
'mcm-81349': 'v0.28.0',
'mcm-81339': 'v0.29.0',
'mcm-81349': 'v0.29.0',
'mcm-lin': 'v0.4.0',
};
let firmwareBaseName = '';
Expand Down
Loading