Skip to content

Conversation

@xiduzo
Copy link
Owner

@xiduzo xiduzo commented Jan 8, 2026

  • Ensures pixel shift uses rounded and parsed number values for accurate shifts.
  • Modifies MQTT connection to ensure the clientId is properly set.
  • Introduces utilities for transforming unknown values to boolean and number types.
  • Adds pins data to the board connection state.

- Ensures pixel shift uses rounded and parsed number values for accurate shifts.
- Modifies MQTT connection to ensure the clientId is properly set.
- Introduces utilities for transforming unknown values to boolean and number types.
- Adds `pins` data to the board connection state.
Copilot AI review requested due to automatic review settings January 8, 2026 14:11
@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
microflow Skipped Skipped Jan 8, 2026 2:11pm

@xiduzo xiduzo merged commit 04b7068 into main Jan 8, 2026
9 of 10 checks passed
@xiduzo xiduzo deleted the fix/pixel branch January 8, 2026 14:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves pixel shift accuracy and MQTT connection reliability. The changes ensure pixel shifts use properly parsed and rounded numeric values, fix MQTT client ID handling by using object-based connection options instead of URL strings, and enhance type transformation utilities with better structure using switch statements.

Key changes:

  • Adds transformValueToNumber to pixel shift logic with rounding for accuracy
  • Refactors MQTT connection to use object-based options ensuring proper clientId configuration
  • Adds pins data tracking to board connection state for better state management

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/runtime/src/pixel/pixel.ts Adds number transformation and rounding to forward pixel shifts; removes verbose console warning
packages/runtime/src/_utils/transformUnknownValues.ts Refactors boolean and number transformation utilities using switch statements for clearer type handling
packages/mqtt-provider/src/stores/mqtt.ts Changes MQTT connection from URL string to object-based options for proper clientId handling; adds path normalization
apps/electron-app/src/main/board-connection.ts Introduces currentPins tracking variable and adds it to connection state responses
Comments suppressed due to low confidence (3)

apps/electron-app/src/main/board-connection.ts:8

  • Unused import BOARDS.
import {
	BOARDS,
	Flasher,
	getConnectedPorts,
	UnableToOpenSerialConnection,
	type BoardName,
	type PortInfo,
} from '@microflow/flasher';

packages/mqtt-provider/src/stores/mqtt.ts:225

  • Unused variable callback.
		for (const [topic, { callback, options }] of Array.from(subscriptions)) {

packages/mqtt-provider/src/stores/mqtt.ts:225

  • For loop variable callback is not used in the loop body.
		for (const [topic, { callback, options }] of Array.from(subscriptions)) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const connectionOptions: mqtt.IClientOptions = {
username: config.username,
password: config.password,
protocol: protocol === 'wss' ? 'wss' : protocol === 'ws' ? 'ws' : 'wss',
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The protocol variable is already typed as 'ws' | 'wss' from parseMqttUrl, so this ternary expression is redundant. You can simplify this to just protocol: protocol or use the shorthand protocol.

Suggested change
protocol: protocol === 'wss' ? 'wss' : protocol === 'ws' ? 'ws' : 'wss',
protocol,

Copilot uses AI. Check for mistakes.
// reconnectPeriod: 1000, // Reconnect after 1 second
// For WSS connections, ensure proper SSL handling
...(protocol === 'wss'
...(protocol === 'wss' || protocol === 'ws'
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SSL options like rejectUnauthorized should only be applied to secure WebSocket connections ('wss'), not to regular WebSocket connections ('ws'). The condition should be protocol === 'wss' only, not include 'ws'.

Suggested change
...(protocol === 'wss' || protocol === 'ws'
...(protocol === 'wss'

Copilot uses AI. Check for mistakes.
case 'number':
return value > 0;
case 'string':
const isTruthy = ['1', 'true', 'on', 'yes'].includes(String(value).toLowerCase());
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value is already confirmed to be a string by the switch statement, so using String(value) is redundant. Consider using value.toLowerCase() directly.

Suggested change
const isTruthy = ['1', 'true', 'on', 'yes'].includes(String(value).toLowerCase());
const isTruthy = ['1', 'true', 'on', 'yes'].includes(value.toLowerCase());

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant