update RGB-Block
This commit is contained in:
@@ -12,7 +12,7 @@ Blockly.Blocks['sensebox_display_beginDisplay'] = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_display_beginDisplay_tooltip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ Blockly.Blocks['sensebox_display_clearDisplay'] = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_display_clearDisplay_tooltip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ Blockly.Blocks['sensebox_display_printDisplay'] = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tooltip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||
},
|
||||
/**
|
||||
* Called whenever anything on the workspace changes.
|
||||
@@ -99,7 +99,7 @@ Blockly.Blocks['sensebox_display_fastPrint'] = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.sensebox_display_fastPrint_tooltip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||
},
|
||||
/**
|
||||
* Called whenever anything on the workspace changes.
|
||||
@@ -160,7 +160,7 @@ Blockly.Blocks['sensebox_display_plotDisplay'] = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_display_printDisplay_tooltip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||
},
|
||||
/**
|
||||
* Called whenever anything on the workspace changes.
|
||||
@@ -221,6 +221,7 @@ Blockly.Blocks['sensebox_display_fillCircle'] = {
|
||||
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
||||
this.setInputsInline(false);
|
||||
this.setTooltip(Blockly.Msg.senseBox_display_fillCircle_tooltip)
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl)
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
},
|
||||
@@ -272,6 +273,7 @@ Blockly.Blocks['sensebox_display_drawRectangle'] = {
|
||||
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
||||
this.setInputsInline(false);
|
||||
this.setTooltip(Blockly.Msg.senseBox_display_drawRectangle_tooltip)
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl)
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as Blockly from 'blockly';
|
||||
import { getColour } from '../helpers/colour'
|
||||
import { selectedBoard } from '../helpers/board'
|
||||
|
||||
import * as Types from '../helpers/types'
|
||||
|
||||
|
||||
Blockly.Blocks['sensebox_led'] = {
|
||||
@@ -15,7 +15,7 @@ Blockly.Blocks['sensebox_led'] = {
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_on, "HIGH"], [Blockly.Msg.senseBox_off, "LOW"]]), "STAT");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_led_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_led_tooltip);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -35,11 +35,31 @@ Blockly.Blocks['sensebox_rgb_led'] = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_rgb_led_tip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Blockly.Blocks['sensebox_ws2818_led_init'] = {
|
||||
init: function () {
|
||||
|
||||
var dropdownOptions = [[Blockly.Msg.senseBox_ultrasonic_port_A, '1'],
|
||||
[Blockly.Msg.senseBox_ultrasonic_port_B, '3'], [Blockly.Msg.senseBox_ultrasonic_port_C, '5']];
|
||||
|
||||
this.setColour(getColour().sensebox);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.senseBox_ws2818_rgb_led_init)
|
||||
.appendField("Port:")
|
||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
|
||||
this.appendValueInput("BRIGHTNESS", "brightness")
|
||||
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_brightness));
|
||||
this.appendValueInput("NUMBER", "number")
|
||||
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_number));
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_ws2818_rgb_led_init_tooltip);
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Blocks['sensebox_ws2818_led'] = {
|
||||
init: function () {
|
||||
|
||||
@@ -51,19 +71,106 @@ Blockly.Blocks['sensebox_ws2818_led'] = {
|
||||
.appendField(Blockly.Msg.senseBox_ws2818_rgb_led)
|
||||
.appendField("Port:")
|
||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port")
|
||||
this.appendValueInput("BRIGHTNESS", "brightness")
|
||||
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_brightness));
|
||||
this.appendValueInput("POSITION", "position")
|
||||
.appendField((Blockly.Msg.senseBox_ws2818_rgb_led_position));
|
||||
this.appendValueInput("RED", 'Number')
|
||||
.appendField(Blockly.Msg.COLOUR_RGB_RED);//Blockly.Msg.senseBox_basic_red
|
||||
this.appendValueInput("GREEN", 'Number')
|
||||
.appendField(Blockly.Msg.COLOUR_RGB_GREEN);//Blockly.Msg.senseBox_basic_green
|
||||
this.appendValueInput("BLUE", 'Number')
|
||||
.appendField(Blockly.Msg.COLOUR_RGB_BLUE);
|
||||
this.appendValueInput("COLOR", 'Number')
|
||||
.appendField(Blockly.Msg.senseBox_ws2818_rgb_led_color)
|
||||
.setCheck("Colour");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_rgb_led_tip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setTooltip(Blockly.Msg.senseBox_ws2818_rgb_led_tooltip);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
// Block for colour picker.
|
||||
{
|
||||
"type": "colour_picker",
|
||||
"message0": "%1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "field_colour",
|
||||
"name": "COLOUR",
|
||||
"colour": "#ff0000"
|
||||
}
|
||||
],
|
||||
"output": "Colour",
|
||||
"helpUrl": "%{BKY_COLOUR_PICKER_HELPURL}",
|
||||
"colour": getColour().sensebox,
|
||||
"tooltip": "%{BKY_COLOUR_PICKER_TOOLTIP}",
|
||||
"extensions": ["parent_tooltip_when_inline"]
|
||||
},
|
||||
|
||||
// Block for random colour.
|
||||
{
|
||||
"type": "colour_random",
|
||||
"message0": "%{BKY_COLOUR_RANDOM_TITLE}",
|
||||
"output": "Colour",
|
||||
"helpUrl": "%{BKY_COLOUR_RANDOM_HELPURL}",
|
||||
"colour": getColour().sensebox,
|
||||
"tooltip": "%{BKY_COLOUR_RANDOM_TOOLTIP}"
|
||||
},
|
||||
|
||||
// Block for composing a colour from RGB components.
|
||||
{
|
||||
"type": "colour_rgb",
|
||||
"message0": "%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RED",
|
||||
"check": Types.getCompatibleTypes('int'),
|
||||
"align": "RIGHT"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "GREEN",
|
||||
"check": Types.getCompatibleTypes('int'),
|
||||
"align": "RIGHT"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "BLUE",
|
||||
"check": Types.getCompatibleTypes('int'),
|
||||
"align": "RIGHT"
|
||||
}
|
||||
],
|
||||
"output": "Colour",
|
||||
"helpUrl": "%{BKY_COLOUR_RGB_HELPURL}",
|
||||
"colour": getColour().sensebox,
|
||||
"tooltip": "%{BKY_COLOUR_RGB_TOOLTIP}"
|
||||
},
|
||||
|
||||
// Block for blending two colours together.
|
||||
{
|
||||
"type": "colour_blend",
|
||||
"message0": "%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} " +
|
||||
"%1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "COLOUR1",
|
||||
"check": "Colour",
|
||||
"align": "RIGHT"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "COLOUR2",
|
||||
"check": "Colour",
|
||||
"align": "RIGHT"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RATIO",
|
||||
"check": "Number",
|
||||
"align": "RIGHT"
|
||||
}
|
||||
],
|
||||
"output": "Colour",
|
||||
"helpUrl": "%{BKY_COLOUR_BLEND_HELPURL}",
|
||||
"style": "colour_blocks",
|
||||
"tooltip": "%{BKY_COLOUR_BLEND_TOOLTIP}"
|
||||
}
|
||||
]); // END JSON EXTRACT (Do not delete this comment.)
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ Blockly.Blocks['sensebox_sd_open_file'] = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_output_safetosd_tip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setTooltip(Blockly.Msg.senseBox_sd_open_file_tooltip);
|
||||
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -32,8 +32,8 @@ Blockly.Blocks['sensebox_sd_create_file'] = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_output_safetosd_tip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setTooltip(Blockly.Msg.senseBox_sd_create_file_tooltip);
|
||||
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -50,8 +50,8 @@ Blockly.Blocks['sensebox_sd_write_file'] = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_output_safetosd_tip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
this.setTooltip(Blockly.Msg.senseBox_sd_write_file_tooltip);
|
||||
this.setHelpUrl('https://docs.sensebox.de/hardware/bee-sd/');
|
||||
},
|
||||
/**
|
||||
* Called whenever anything on the workspace changes.
|
||||
|
||||
@@ -18,7 +18,7 @@ Blockly.Blocks['sensebox_sensor_temp_hum'] = {
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_temp, "Temperature"], [Blockly.Msg.senseBox_hum, "Humidity"]]), "NAME");
|
||||
this.setOutput(true, Types.DECIMAL.typeName);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_temp_hum_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_temp_hum_tooltip);
|
||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/temp_und_luftfeuchte.html');
|
||||
}
|
||||
};
|
||||
@@ -39,7 +39,7 @@ Blockly.Blocks['sensebox_sensor_uv_light'] = {
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_light, "Illuminance"], [Blockly.Msg.senseBox_uv, "UvIntensity"]]), "NAME");
|
||||
this.setOutput(true, Types.DECIMAL.typeName);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_uv_light_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_uv_light_tooltip);
|
||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/temp_und_luftfeuchte.html');
|
||||
}
|
||||
};
|
||||
@@ -62,7 +62,7 @@ Blockly.Blocks['sensebox_sensor_bmx055_accelerometer'] = {
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_bmx055_accelerometer_range_2g, "0x3"], [Blockly.Msg.senseBox_bmx055_accelerometer_range_4g, "0x5"], [Blockly.Msg.senseBox_bmx055_accelerometer_range_8g, "0x8"], [Blockly.Msg.senseBox_bmx055_accelerometer_range_16g, "0x0C"]]), "RANGE");
|
||||
this.setOutput(true, Types.DECIMAL.typeName);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_bmx055_accelerometer_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_bmx055_accelerometer_tooltip);
|
||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/temp_und_luftfeuchte.html');
|
||||
}
|
||||
};
|
||||
@@ -84,7 +84,7 @@ Blockly.Blocks['sensebox_sensor_sds011'] = {
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_sds011_serial1, "Serial1"], [Blockly.Msg.senseBox_sds011_serial2, "Serial2"]]), "SERIAL");
|
||||
this.setOutput(true, Types.DECIMAL.typeName);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_sds011_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_sds011_tooltip);
|
||||
this.setHelpUrl('https://edu.books.sensebox.de/de/projekte/diy_umweltstation/temp_und_luftfeuchte.html');
|
||||
}
|
||||
};
|
||||
@@ -209,7 +209,7 @@ Blockly.Blocks['sensebox_sensor_ultrasonic_ranger'] = {
|
||||
.appendField(new Blockly.FieldDropdown(
|
||||
selectedBoard().digitalPins), 'ultrasonic_echo');
|
||||
this.setOutput(true, Types.NUMBER.typeName);
|
||||
this.setTooltip(Blockly.Msg.senseBox_ultrasonic_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_ultrasonic_tooltip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
},
|
||||
/**
|
||||
@@ -295,7 +295,7 @@ Blockly.Blocks['sensebox_button'] = {
|
||||
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPinsButton), "PIN");
|
||||
this.setOutput(true, Types.BOOLEAN.typeName);
|
||||
this.setColour(getColour().sensebox);
|
||||
this.setTooltip(Blockly.Msg.senseBox_button_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_button_tooltip);
|
||||
this.setHelpUrl('https://sensebox.de/books');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@ Blockly.Blocks["sensebox_telegram"] = {
|
||||
.appendField("telegram")
|
||||
.appendField(new Blockly.FieldTextInput("token"), "telegram_token");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_telegram_init_tooltip);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
};
|
||||
@@ -24,6 +25,7 @@ Blockly.Blocks["sensebox_telegram_do"] = {
|
||||
this.appendStatementInput("telegram_do");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_telegram_do_tooltip)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -36,6 +38,7 @@ Blockly.Blocks["sensebox_telegram_do_on_message"] = {
|
||||
.appendField(Blockly.Msg.senseBox_telegram_message)
|
||||
.appendField(new Blockly.FieldTextInput("/message"), 'telegram_message');
|
||||
this.appendStatementInput("telegram_do_on_message").setCheck(null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_telegram_message_tooltip)
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
@@ -46,8 +49,10 @@ Blockly.Blocks["sensebox_telegram_send"] = {
|
||||
this.setColour(getColour().sensebox);
|
||||
this.appendDummyInput().appendField(Blockly.Msg.senseBox_telegram_send);
|
||||
this.appendValueInput("telegram_text_to_send").setCheck(null);
|
||||
this.setTooltip(Blockly.Msg.senseBox_telegram_send_tooltip)
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
|
||||
},
|
||||
LOOP_TYPES: ["sensebox_telegram_do_on_message"]
|
||||
};
|
||||
@@ -3,7 +3,7 @@ import { getColour } from '../helpers/colour'
|
||||
|
||||
Blockly.Blocks['sensebox_wifi'] = {
|
||||
init: function () {
|
||||
this.setTooltip(Blockly.Msg.senseBox_wifi_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_wifi_tooltip);
|
||||
this.setHelpUrl('');
|
||||
this.setColour(getColour().sensebox);
|
||||
this.appendDummyInput()
|
||||
@@ -16,6 +16,7 @@ Blockly.Blocks['sensebox_wifi'] = {
|
||||
.setAlign(Blockly.ALIGN_LEFT)
|
||||
.appendField(Blockly.Msg.senseBox_output_password)
|
||||
.appendField(new Blockly.FieldTextInput("Password"), "Password");
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl)
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
},
|
||||
@@ -43,7 +44,7 @@ Blockly.Blocks['sensebox_wifi'] = {
|
||||
|
||||
Blockly.Blocks['sensebox_startap'] = {
|
||||
init: function () {
|
||||
this.setTooltip(Blockly.Msg.senseBox_wifi_tip);
|
||||
this.setTooltip(Blockly.Msg.senseBox_wifi_startap_tooltip);
|
||||
this.setHelpUrl('');
|
||||
this.setColour(getColour().sensebox);
|
||||
this.appendDummyInput()
|
||||
@@ -52,6 +53,7 @@ Blockly.Blocks['sensebox_startap'] = {
|
||||
.setAlign(Blockly.ALIGN_LEFT)
|
||||
.appendField(Blockly.Msg.senseBox_wifi_ssid)
|
||||
.appendField(new Blockly.FieldTextInput("SSID"), "SSID");
|
||||
this.setHelpUrl(Blockly.Msg.senseBox_wifi_helpurl)
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user