feat: sync arduino source board configurations

This commit is contained in:
yczpf2019
2026-01-24 16:16:48 +08:00
parent 6dce82e125
commit c9195c03e1
1051 changed files with 59815 additions and 0 deletions

View File

@@ -0,0 +1,223 @@
import * as Blockly from 'blockly/core';
import CITYS_DATA from '../templates/json/cities.json';
const ETHERNET_HUE = 0;
const WEATHER_HUE = '#27b6ac';
/**
* @name 模块名 Http GET请求
* @support 支持板卡 {ESP8266, ESP32, ESP32C3, ESP32S2, ESP32S3}
*/
export const http_get = {
init: function () {
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_GET_REQUEST);
this.appendValueInput("api")
.setCheck(null)
.appendField(Blockly.Msg.blynk_SERVER_ADD);
this.appendStatementInput("success")
.setCheck(null)
.appendField(Blockly.Msg.MIXLY_SUCCESS);
this.appendStatementInput("failure")
.setCheck(null)
.appendField(Blockly.Msg.MIXLY_FAILED);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(ETHERNET_HUE);
this.setTooltip("");
}
};
/**
* @name 模块名 Http PATCH|POST|PUT请求
* @support 支持板卡 {ESP8266, ESP32, ESP32C3, ESP32S2, ESP32S3}
*/
export const http_post = {
init: function () {
this.appendDummyInput()
.appendField(new Blockly.FieldDropdown([
["POST", "POST"],
["PATCH", "PATCH"],
["PUT", "PUT"]
]), "TYPE")
.appendField(Blockly.Msg.blockpy_REQUESTS);
this.appendValueInput("api")
.setCheck(null)
.appendField(Blockly.Msg.blynk_SERVER_ADD);
this.appendValueInput("data")
.setCheck(null)
.appendField(Blockly.Msg.MIXLY_SD_DATA);
this.appendStatementInput("success")
.setCheck(null)
.appendField(Blockly.Msg.MIXLY_SUCCESS);
this.appendStatementInput("failure")
.setCheck(null)
.appendField(Blockly.Msg.MIXLY_FAILED);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(ETHERNET_HUE);
this.setTooltip("");
}
};
var PROVINCES = [], key;
for (key in CITYS_DATA)
PROVINCES.push([key, key]);
function getCitysByProvince(a) {
var b = [], c;
for (c in CITYS_DATA[a])
b.push([c, c]);
return b;
}
var citysByProvince = {};
for (key of PROVINCES) {
citysByProvince[key[0]] = getCitysByProvince(key[0]);
}
export const china_city = {
init: function () {
const defaultOptions = [["-", "-"]];
this.appendDummyInput()
.appendField(new Blockly.FieldDropdown(PROVINCES), "province")
.appendField(new Blockly.FieldDependentDropdown("province", citysByProvince, defaultOptions), "city");
this.setInputsInline(true);
this.setOutput(true, null);
this.setColour(WEATHER_HUE);
this.setHelpUrl("");
this.preProvince = null;
}
};
export const weather_private_key = {
init: function () {
this.setColour(WEATHER_HUE);
this.appendDummyInput("")
.appendField(new Blockly.FieldDropdown([['S9l2sb_ZK-UsWaynG', 'S9l2sb_ZK-UsWaynG'], ['SpRpSYb7QOMT0M8Tz', 'SpRpSYb7QOMT0M8Tz'], ['SboqGMxP4tYNXUN8f', 'SboqGMxP4tYNXUN8f'], ['SJiRrYGYFkGnfi081', 'SJiRrYGYFkGnfi081'], ['SMhSshUxuTL0GLVLS', 'SMhSshUxuTL0GLVLS']]), 'key');
this.setOutput(true, null);
}
};
export const weather_seniverse_city_weather = {
init: function () {
this.appendDummyInput("")
.appendField(Blockly.Msg.MSG.catweather)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LIVE_WEATHER, "weather/now"], [Blockly.Msg.MIXLY_3_DAY_WEATHER_FORECAST, "weather/daily"], [Blockly.Msg.MIXLY_6_LIFE_INDEXES, "life/suggestion"]]), "api")
.appendField(Blockly.Msg.MIXLY_INFORMATION_CONFIGURATION);
this.appendValueInput("location")
.setCheck(null)
.appendField(Blockly.Msg.MIXLY_GEOGRAPHIC_LOCATION);
this.appendValueInput("private_key")
.setCheck(null)
.appendField(Blockly.Msg.MIXLY_API_PRIVATE_KEY);
this.appendDummyInput("")
.appendField(Blockly.Msg.MIXLY_LANGUAGE)
.appendField(new Blockly.FieldDropdown([
["简体中文", "zh-Hans"],
["繁體中文", "zh-Hant"],
["English", "en"]
]), "language");
this.appendDummyInput("")
.appendField(Blockly.Msg.MIXLY_TEMPERATURE_UNIT)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_CELSIUS + "(℃)", "c"], [Blockly.Msg.MIXLY_FAHRENHEIT + "(℉)", "f"]]), "unit");
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(WEATHER_HUE);
this.setTooltip("这里的API私钥免费体验有次数限制\n访问频率限制20次/分钟");
this.setHelpUrl("");
}
};
export const weather_get_seniverse_weather_info = {
init: function () {
this.appendDummyInput("")
//.appendField("心知天气")
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MIXLY_LIVE_WEATHER, "weather/now"],
[Blockly.Msg.MIXLY_3_DAY_WEATHER_FORECAST, "weather/daily"],
[Blockly.Msg.MIXLY_6_LIFE_INDEXES, "life/suggestion"]
]), "api")
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MIXLY_AVAILABLE, "update"],
[Blockly.Msg.MIXLY_GET_DATA_UPDATE_TIME, "getLastUpdate"],
[Blockly.Msg.MIXLY_GET_SERVER_RESPONSE_STATUS_CODE, "getServerCode"]
]), "type");
this.setInputsInline(true);
this.setOutput(true, null);
this.setColour(WEATHER_HUE);
this.setTooltip("");
this.setHelpUrl("");
}
};
export const weather_get_seniverse_weather_info1 = {
init: function () {
this.appendDummyInput("")
//.appendField("心知天气")
.appendField(Blockly.Msg.MIXLY_LIVE_WEATHER)
.appendField(Blockly.Msg.MIXLY_GET)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_WEATHER_PHENOMENON, "getWeatherText"], [Blockly.Msg.MIXLY_WEATHER_PHENOMENON_CODE, "getWeatherCode"], [Blockly.Msg.MIXLY_TEMPERATURE, "getDegree"]]), "type");
this.setInputsInline(true);
this.setOutput(true, null);
this.setColour(WEATHER_HUE);
this.setTooltip("");
this.setHelpUrl("");
}
};
export const weather_get_seniverse_weather_info2 = {
init: function () {
this.appendDummyInput("")
//.appendField("心知天气")
.appendField(Blockly.Msg.MIXLY_3_DAY_WEATHER_FORECAST)
.appendField(Blockly.Msg.MIXLY_GET)
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_TODAY, "0"], [Blockly.Msg.MIXLY_TOMORROW, "1"], [Blockly.Msg.MIXLY_DAY_AFTER_TOMORROW, "2"]]), "date")
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.ForecastHigh, "getHigh"],
[Blockly.Msg.ForecastLow, "getLow"],
[Blockly.Msg.MIXLY_DAYTIME_WEATHER_PHENOMENON, "getDayText"],
[Blockly.Msg.MIXLY_DAYTIME_WEATHER_PHENOMENON_CODE, "getDayCode"],
[Blockly.Msg.MIXLY_EVENING_WEATHER_PHENOMENON, "getNightText"],
[Blockly.Msg.MIXLY_EVENING_WEATHER_PHENOMENON_CODE, "getNightCode"],
[Blockly.Msg.MIXLY_PROBABILITY_OF_PRECIPITATION, "getRain"],
[Blockly.Msg.ForecastFx, "getWindDirection"],
[Blockly.Msg.MIXLY_WIND_SPEED, "getWindSpeed"],
[Blockly.Msg.MIXLY_WIND_RATING, "getWindScale"],
[Blockly.Msg.MIXLY_Humidity, "getHumidity"]
]), "type");
this.setInputsInline(true);
this.setOutput(true, null);
this.setColour(WEATHER_HUE);
this.setTooltip("");
this.setHelpUrl("");
}
};
export const weather_get_seniverse_weather_info3 = {
init: function () {
this.appendDummyInput("")
//.appendField("心知天气")
.appendField(Blockly.Msg.MIXLY_6_LIFE_INDEXES)
.appendField(Blockly.Msg.MIXLY_GET)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MIXLY_CAR_WASH_INDEX, "getCarWash"],
[Blockly.Msg.MIXLY_DRESSING_INDEX, "getDressing"],
[Blockly.Msg.MIXLY_COLD_INDEX, "getFactorFlu"],
[Blockly.Msg.MIXLY_MOVEMENT_INDEX, "getExercise"],
[Blockly.Msg.MIXLY_TOURISM_INDEX, "getTravel"],
[Blockly.Msg.MIXLY_UV_INDEX, "getUV"]]
), "type");
this.setInputsInline(true);
this.setOutput(true, null);
this.setColour(WEATHER_HUE);
this.setTooltip("");
this.setHelpUrl("");
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
import * as Blockly from 'blockly/core';
const TEXTS_HUE = 160;
export const text_base64_url_codec = {
init: function () {
this.appendValueInput('VALUE')
.setCheck(null)
.setAlign(Blockly.inputs.Align.LEFT)
.appendField(new Blockly.FieldDropdown([
['Base64', 'BASE64'],
['URL', 'URL']
]), 'TYPE')
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MIXPY_TEXT_ENCODE, 'ENCODE'],
[Blockly.Msg.MIXPY_TEXT_DECODE, 'DECODE']
]), 'OPTION');
this.setOutput(true, null);
this.setColour(TEXTS_HUE);
this.setTooltip('');
this.setHelpUrl('');
}
};

View File

@@ -0,0 +1,85 @@
import * as Blockly from 'blockly/core';
import { Variables } from 'blockly/core';
const VARIABLES_HUE = 330;
export const variables_declare = {
init: function () {
this.setColour(VARIABLES_HUE);
this.appendValueInput('VALUE', null)
.appendField(Blockly.Msg.MIXLY_DECLARE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MIXLY_GLOBAL_VARIABLE, 'global_variate'],
[Blockly.Msg.MIXLY_LOCAL_VARIABLE, 'local_variate']
]), 'variables_type')
.appendField(new Blockly.FieldTextInput('item'), 'VAR')
.appendField(Blockly.Msg.MIXLY_AS)
.appendField(new Blockly.FieldDropdown(Variables.DATA_TYPE), 'TYPE')
.appendField(Blockly.Msg.MIXLY_VALUE);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_VARIABLES_DECLARE);
},
getVars: function () {
return [this.getFieldValue('VAR')];
},
renameVar: function (oldName, newName) {
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
}
};
export const variables_get = {
init: function () {
this.setColour(VARIABLES_HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldTextInput('item'), 'VAR')
this.setOutput(true);
this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP);
},
getVars: function () {
return [this.getFieldValue('VAR')];
},
renameVar: function (oldName, newName) {
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
}
};
export const variables_set = {
init: function () {
this.setColour(VARIABLES_HUE);
this.appendValueInput('VALUE')
.appendField(new Blockly.FieldTextInput('item'), 'VAR')
.appendField(Blockly.Msg.MIXLY_VALUE2);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.VARIABLES_SET_TOOLTIP);
},
getVars: function () {
return [this.getFieldValue('VAR')];
},
renameVar: function (oldName, newName) {
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
}
};
/**
* Block for basic data type change.
* @this Blockly.Block
*/
export const variables_change = {
init: function () {
this.setColour(VARIABLES_HUE);
this.appendValueInput('MYVALUE')
.appendField(new Blockly.FieldDropdown(Variables.DATA_TYPE), 'OP');
// Assign 'this' to a variable for use in the tooltip closure below.
this.setOutput(true);
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_VARIABLES_CHANGE);
}
};