Merge branch 'main' into base-function
This commit is contained in:
commit
2b2646a768
4 changed files with 134 additions and 1 deletions
|
|
@ -3359,6 +3359,11 @@ Pattern.prototype.shrinklist = function (amount) {
|
|||
|
||||
export const shrinklist = (amount, pat) => pat.shrinklist(amount);
|
||||
|
||||
Pattern.prototype.growlist = function (amount) {
|
||||
return this.shrinklist(amount).reverse();
|
||||
};
|
||||
export const growlist = (amount, pat) => pat.growlist(amount);
|
||||
|
||||
/**
|
||||
* *Experimental*
|
||||
*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://codeberg.org/uzu/strudel/
|
|||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Pattern, isPattern } from '@strudel/core';
|
||||
import { Pattern, isPattern, createParams } from '@strudel/core';
|
||||
import Paho from 'paho-mqtt';
|
||||
|
||||
const connections = {};
|
||||
|
|
@ -118,3 +118,11 @@ Pattern.prototype.mqtt = function (
|
|||
return hap.setContext({ ...hap.context, onTrigger, dominantTrigger: true });
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// This adds the 'move' and 'motor' commands to strudel
|
||||
export const { move, motor } = createParams('move', 'motor'); window.move = move; window.motor = motor;
|
||||
// This adds the 'robot' command
|
||||
Pattern.prototype.robot = function (robot_id, address = 'ws://192.168.8.248:9001/mqtt') {
|
||||
return this.mqtt(undefined, undefined, '/move/' + robot_id, address);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue