add fan speed readout

This commit is contained in:
Stewart Allen 2025-02-02 00:09:19 -05:00
commit 78ca7fe185
4 changed files with 50 additions and 3 deletions

View file

@ -162,7 +162,7 @@ self.kiri.load(api => {
chamber_temper,
cooling_fan_speed,
gcode_file,
gcode_state, // PAUSE, RUNNING, FAILED
gcode_state, // PREPARE, PAUSE, RUNNING, FAILED
heatbreak_fan_speed,
layer_num,
mc_percent,
@ -185,6 +185,11 @@ self.kiri.load(api => {
$('bbl_pause').disabled = (gcode_state !== 'RUNNING');
$('bbl_resume').disabled = (gcode_state !== 'PAUSE');
$('bbl_resume').disabled = (gcode_state !== 'FAILED');
$('bbl_fan_part').value = cooling_fan_speed || 0;
$('bbl_fan_1').value = big_fan1_speed || 0;
$('bbl_fan_2').value = big_fan2_speed || 0;
$('bbl_fan_heatbreak').value = heatbreak_fan_speed || 0;
$('bbl_file_active').value = gcode_file || '';
if (files && filelist.selectedIndex === -1) {
h.bind(filelist, files.map(file => {
let name = file.name
@ -384,6 +389,27 @@ self.kiri.load(api => {
h.label('target'),
h.input({ id: "bbl_bed_target", size: 5 })
])
]),
h.div({ class: "t-body t-inset f-col" }, [
h.label({ class: "set-header dev-sel" }, [
h.a('fans')
]),
h.div({ class: "var-row" }, [
h.label('part'),
h.input({ id: "bbl_fan_part", size: 5 })
]),
h.div({ class: "var-row" }, [
h.label('fan1'),
h.input({ id: "bbl_fan_1", size: 5 })
]),
h.div({ class: "var-row" }, [
h.label('fan2'),
h.input({ id: "bbl_fan_2", size: 5 })
]),
h.div({ class: "var-row" }, [
h.label('heatbreak'),
h.input({ id: "bbl_fan_heatbreak", size: 5 })
])
])
]),
h.div({ class: "f-col gap4 grow" }, [
@ -432,6 +458,14 @@ self.kiri.load(api => {
console.log({ printing: selected.file.path });
file_print(selected.file.path);
}}),
]),
h.div({ class: "t-body t-inset f-col gap3 pad4" }, [
h.label({ class: "set-header dev-sel" }, [
h.a('active file')
]),
h.div({ class: "var-row" }, [
h.input({ id: "bbl_file_active", disabled: true })
]),
])
])
]),

View file

@ -32,7 +32,7 @@ rl.on('line', (line) => {
break;
default:
if (line.startsWith('M') || line.startsWith('G') || line.startsWith('T')) {
line = line.split(';').map(l => l.trim()).join('\n');
line = line.split(';').map(l => l.trimStart()).join('\n');
sendGcode(line);
} else if (line.startsWith('ams ')) {
amsmap = JSON.parse(line.substring(4));

View file

@ -11,6 +11,7 @@ module.exports = async (server) => {
class MQTT {
#timer;
#timer2;
#client;
#serial;
#topic_report;
@ -39,6 +40,7 @@ module.exports = async (server) => {
util.log('mqtt sub', this.#serial, err || "ok");
onready(this);
this.keepalive();
this.keepconn();
});
});
@ -59,6 +61,17 @@ module.exports = async (server) => {
this.#timer = setTimeout(() => { this.end() }, 30000);
}
keepconn() {
clearTimeout(this.#timer2);
this.#timer2 = setTimeout(() => { this.end() }, 60000);
if_mqtt(this.#serial, {
pushing: {
sequence_id: "0",
command: "push_status"
}
});
}
async send(msg) {
if (this.#client) {
util.log('mqtt send', this.#serial, msg);