Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
00a0dad
Implement libs (Project, Package, Registry)
JakubAndrysek Oct 29, 2025
08a543c
Refactor registry URL variable names for consistency
JakubAndrysek Oct 29, 2025
55cc9b8
Refactor test utilities and improve test assertions in project tests
JakubAndrysek Oct 29, 2025
9b6bb77
Refactor import of TarBrowserify to use default import and destructur…
JakubAndrysek Oct 29, 2025
c2ad9ed
fix: resolve reported changes
JakubAndrysek Nov 1, 2025
ee42ad3
refactor: update compile function parameters and logging mechanism
JakubAndrysek Nov 6, 2025
aa1a37a
feat: add JacLy blocks for ADC, GPIO, and STDIO; update package.json …
JakubAndrysek Nov 9, 2025
6df206e
feat: enhance Project class with installedLibraries method and sync l…
JakubAndrysek Nov 11, 2025
5f79b07
feat: enhance registry management with schema validation and improved…
JakubAndrysek Nov 21, 2025
8dec9ad
feat: update project and registry to use 'colour' instead of 'color';…
JakubAndrysek Dec 23, 2025
a2a6c97
feat: move uploadIfDifferent method to Uploader class; enhance file s…
JakubAndrysek Feb 2, 2026
53f2ed3
feat: enhance Project and Registry classes with improved dependency h…
JakubAndrysek Feb 9, 2026
587bf29
feat: refactor Registry instantiation to use static create method for…
JakubAndrysek Feb 9, 2026
ac4d2f0
feat: enhance WiFi configuration management with new methods and enum…
JakubAndrysek Feb 12, 2026
0742d9a
feat: refactor firmware and project structure to enhance type safety …
JakubAndrysek Feb 17, 2026
8855fec
refactor whole project and change structure, fix tests
JakubAndrysek Feb 20, 2026
c51c2b0
feat: implement project and library compilation commands with validat…
JakubAndrysek Feb 21, 2026
23d7056
feat: add optional scripts field to PackageJsonSchema for enhanced pa…
JakubAndrysek Feb 22, 2026
b8f693b
refactor logging, commands
JakubAndrysek Mar 9, 2026
a025fd0
feat: refactor project and registry handling to improve type safety a…
JakubAndrysek Mar 10, 2026
5b9190d
Refactor project tests to use updated imports and logger integration
JakubAndrysek Mar 10, 2026
3957a19
refactor: Remove Writable stream parameter and replace direct output …
JakubAndrysek Mar 10, 2026
0559ade
refactor: Replace Writable stream with logger in Project class and re…
JakubAndrysek Mar 12, 2026
d0da4d7
refactor: fix error handling in copyFolder function and remove unused…
JakubAndrysek Mar 18, 2026
b71766e
refactor: rename installedLibraries to listDependencies
JakubAndrysek Mar 18, 2026
db1666e
refactor: remove unused fileSha1 and uploadIfDifferentFs functions fr…
JakubAndrysek Mar 18, 2026
aa9c1c4
refactor: enhance PackageJsonSchema to preserve unknown top-level fie…
JakubAndrysek Mar 18, 2026
601938b
refactor: implement ensureDirectoryExists function for recursive dire…
JakubAndrysek Mar 18, 2026
1611f02
refactor: update Controller and Uploader to support progress callback…
JakubAndrysek Mar 18, 2026
cce0e8c
refactor: update compiler options validation and enhance lib-list com…
JakubAndrysek Mar 18, 2026
7e37dcc
refactor: add Jakub Andrýsek as a contributor to package.json files a…
JakubAndrysek Mar 19, 2026
b3c0fb5
refactor: add archive import/export utilities and update project comm…
JakubAndrysek Mar 19, 2026
96fe04a
refactor: introduce ProjectBundle interface and update related functi…
JakubAndrysek Mar 22, 2026
448b77e
refactor: improve logging messages for project compilation and depend…
JakubAndrysek Mar 22, 2026
315853c
Fix package naming
JakubAndrysek Mar 23, 2026
098d865
refactor: update lib-list command to use 'all' option for transitive …
JakubAndrysek Mar 23, 2026
a5bcca1
refactor: remove base64 libs, fix and extend JaculusSchema
JakubAndrysek Mar 23, 2026
48b58d7
refactor: update entry point handling and improve file collection log…
JakubAndrysek Mar 24, 2026
5c97a60
refactor: enhance uploader progress tracking and improve flash progre…
JakubAndrysek Mar 24, 2026
a033217
refactor: rename and unify file collection methods for clarity and co…
JakubAndrysek Mar 24, 2026
c830442
refactor: convert instance methods to static for file handling in Pro…
JakubAndrysek Mar 24, 2026
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
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
"@eslint/js": "^9.38.0",
"@jaculus/link": "workspace:*",
"@jaculus/project": "workspace:*",
"jaculus-tools": "workspace:*",
"@jaculus/common": "workspace:*",
"@obsidize/tar-browserify": "^6.3.2",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/node": "^24.0.7",
"@types/pako": "^2.0.4",
"@zenfs/core": "^1.11.4",
"chai": "^5.1.2",
"chai-bytes": "^0.1.2",
Expand All @@ -31,6 +35,7 @@
"husky": "^9.1.7",
"jiti": "^2.5.1",
"mocha": "^11.7.2",
"pako": "^2.1.0",
"prettier": "^3.6.2",
"queue-fifo": "^0.2.5",
"tsx": "^4.20.6",
Expand Down
6 changes: 6 additions & 0 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
"author": {
"name": "Petr Kubica (cubicap)"
},
"contributors": [
{
"name": "Jakub Andrýsek (JakubAndrysek)",
"url": "https://kubaandrysek.cz/"
}
],
"license": "GPL-3.0-only",
"type": "module",
"exports": {
Expand Down
10 changes: 10 additions & 0 deletions packages/common/src/buffer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export function concatUint8Arrays(chunks: Uint8Array[]): Uint8Array {
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
const result = new Uint8Array(totalLength);
let offset = 0;
for (const chunk of chunks) {
result.set(chunk, offset);
offset += chunk.length;
}
return result;
}
4 changes: 4 additions & 0 deletions packages/common/src/bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ProjectBundle {
dirs: Set<string>;
files: Record<string, Uint8Array>;
}
14 changes: 4 additions & 10 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
type LogMethod = (message?: string) => void;

export interface Logger {
error: LogMethod;
warn: LogMethod;
info: LogMethod;
verbose: LogMethod;
debug: LogMethod;
silly: LogMethod;
}
export { Logger } from "./logger.js";
export { RequestFunction, getRequestJson, JaculusRequestError } from "./request.js";
export { concatUint8Arrays } from "./buffer.js";
export { type ProjectBundle } from "./bundle.js";
10 changes: 10 additions & 0 deletions packages/common/src/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type LogMethod = (message?: string) => void;

export interface Logger {
error: LogMethod;
warn: LogMethod;
info: LogMethod;
verbose: LogMethod;
debug: LogMethod;
silly: LogMethod;
}
19 changes: 19 additions & 0 deletions packages/common/src/request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export type RequestFunction = (baseUri: string, libFile: string) => Promise<Uint8Array>;

export async function getRequestJson(
getRequest: RequestFunction,
baseUri: string,
libFile: string
): Promise<any> {
return getRequest(baseUri, libFile).then((data) => {
const text = new TextDecoder().decode(data);
return JSON.parse(text);
});
}

export class JaculusRequestError extends Error {
constructor(message: string) {
super(message);
this.name = "JaculusRequestError";
}
}
6 changes: 6 additions & 0 deletions packages/device/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
"author": {
"name": "Petr Kubica (cubicap)"
},
"contributors": [
{
"name": "Jakub Andrýsek (JakubAndrysek)",
"url": "https://kubaandrysek.cz/"
}
],
"license": "GPL-3.0-only",
"type": "module",
"main": "./dist/device.js",
Expand Down
95 changes: 92 additions & 3 deletions packages/device/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ export const ControllerCommandStrings: Record<ControllerCommand, string> = {
[ControllerCommand.CONFIG_ERASE]: "CONFIG_ERASE",
};

enum WifiKvNs {
Ssids = "wifi_net",
Main = "wifi_cfg",
}

enum WifiKeys {
Mode = "mode",
StaMode = "sta_mode",
StaSpecific = "sta_ssid",
StaApFallback = "sta_ap_fallback",
ApSsid = "ap_ssid",
ApPass = "ap_pass",
CurrentIp = "current_ip",
}

export enum WifiMode {
DISABLED = 0,
STATION = 1,
AP = 2,
}

export enum WifiStaMode {
BEST_SIGNAL = 0,
SPECIFIC_SSID = 1,
}

enum KeyValueDataType {
INT64 = 0,
FLOAT32 = 1,
Expand Down Expand Up @@ -82,8 +108,8 @@ export class Controller {
return false;
}

public start(path: string): Promise<void> {
this._logger?.verbose("Starting program: " + path);
public start(entryPoint: string = ""): Promise<void> {
this._logger?.verbose("Starting program: " + (entryPoint ? entryPoint : ""));
return new TimeoutPromise(
TIMEOUT_MS,
(resolve, reject) => {
Expand All @@ -98,7 +124,7 @@ export class Controller {

const packet = this._out.buildPacket();
packet.put(ControllerCommand.START);
for (const c of path) {
for (const c of entryPoint) {
packet.put(c.charCodeAt(0));
}
packet.send();
Expand Down Expand Up @@ -449,4 +475,67 @@ export class Controller {
}
);
}

// WiFi Configuration Methods
public async addWifiNetwork(ssid: string, password: string): Promise<void> {
this._logger?.verbose(`Adding WiFi network: ${ssid}`);
return this.configSetString(WifiKvNs.Ssids, ssid.substring(0, 15), password);
}

public async removeWifiNetwork(ssid: string): Promise<void> {
this._logger?.verbose(`Removing WiFi network: ${ssid}`);
return this.configErase(WifiKvNs.Ssids, ssid);
}

public getWifiMode(): Promise<WifiMode> {
return this.configGetInt(WifiKvNs.Main, WifiKeys.Mode) as Promise<WifiMode>;
}

public setWifiMode(mode: WifiMode): Promise<void> {
return this.configSetInt(WifiKvNs.Main, WifiKeys.Mode, mode);
}

public getWifiStaMode(): Promise<WifiStaMode> {
return this.configGetInt(WifiKvNs.Main, WifiKeys.StaMode) as Promise<WifiStaMode>;
}

public setWifiStaMode(mode: WifiStaMode): Promise<void> {
return this.configSetInt(WifiKvNs.Main, WifiKeys.StaMode, mode);
}

public getWifiStaSpecific(): Promise<string> {
return this.configGetString(WifiKvNs.Main, WifiKeys.StaSpecific);
}

public setWifiStaSpecific(ssid: string): Promise<void> {
return this.configSetString(WifiKvNs.Main, WifiKeys.StaSpecific, ssid);
}

public getWifiStaApFallback(): Promise<number> {
return this.configGetInt(WifiKvNs.Main, WifiKeys.StaApFallback);
}

public setWifiStaApFallback(enabled: boolean): Promise<void> {
return this.configSetInt(WifiKvNs.Main, WifiKeys.StaApFallback, enabled ? 1 : 0);
}

public getWifiApSsid(): Promise<string> {
return this.configGetString(WifiKvNs.Main, WifiKeys.ApSsid);
}

public setWifiApSsid(ssid: string): Promise<void> {
return this.configSetString(WifiKvNs.Main, WifiKeys.ApSsid, ssid);
}

public getWifiApPassword(): Promise<string> {
return this.configGetString(WifiKvNs.Main, WifiKeys.ApPass);
}

public setWifiApPassword(password: string): Promise<void> {
return this.configSetString(WifiKvNs.Main, WifiKeys.ApPass, password);
}

public getCurrentWifiIp(): Promise<string> {
return this.configGetString(WifiKvNs.Main, WifiKeys.CurrentIp);
}
}
6 changes: 4 additions & 2 deletions packages/device/src/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import {
} from "@jaculus/link/muxCommunicator";
import { CobsEncoder } from "@jaculus/link/encoders/cobs";
import { Uploader } from "./uploader.js";
import { Controller } from "./controller.js";
import { Controller, WifiMode, WifiStaMode } from "./controller.js";

export { Uploader, Controller };
export { Uploader, type UploaderProgress, type UploaderProgressCallback } from "./uploader.js";
export { type ProjectBundle } from "@jaculus/common";
export { Controller, WifiMode, WifiStaMode };

export class JacDevice {
private _mux: Mux;
Expand Down
Loading
Loading