Skip to content
Snippets Groups Projects
Commit 289cc9d7 authored by ft-Demo's avatar ft-Demo
Browse files

commit by robo pro coding

parent a497b33b
No related branches found
No related tags found
No related merge requests found
<xml xmlns="https://developers.google.com/blockly/xml" version="2">
<xml xmlns="https://developers.google.com/blockly/xml" version="9">
<variables>
<variable id="HuRd}q%zRj|l]`0]9+,v">t</variable>
<variable id="E#)K*ceuQH)cM);bvVSl">iaq</variable>
<variable id="(lIqPZvC*jYE@#I.!=Wy">h</variable>
<variable id="|]?yRgy2?Z3VWuPxsG(2">p</variable>
<variable id="E#)K*ceuQH)cM);bvVSl">iaq</variable>
</variables>
<block type="start_block" id="m4V$1bSXH=m-3c)X8_S~" deletable="false" x="0" y="0">
<field name="checkbox">FALSE</field>
<statement name="statement">
<block type="display_run" id="jb|rB)Gx]=RW:jCPnD7@">
<block type="controls_if" id="|*N?dy4b]mR)1qB^GIVQ">
<value name="IF0">
<block type="i2c_environment_sensor_if_need_calibration" id="3w]@E,omem,lXI6e1}43">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
</block>
</value>
<statement name="DO0">
<block type="i2c_environment_sensor_calibrate" id="{fUdeV*[@7InWg;*mA{t">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
</block>
</statement>
<next>
<block type="loop_endless" id="hdFJ%=n3xslHK{*5r2U4">
<statement name="DO">
<block type="variables_set" id="/*`sbu=``h|;*`X9omR;">
<field name="VAR" id="HuRd}q%zRj|l]`0]9+,v">t</field>
<value name="VALUE">
<block type="i2c_environment_sensor_get_temperature" id="buatR#.x9UN7cRK)|.?5">
<block type="controls_if" id="+3E##~SP$0W7bEi7!wc7">
<mutation elseif="0" else="1"/>
<value name="IF0">
<block type="i2c_environment_sensor_if_need_calibration" id="W3qjw,?w@gN:6ANmgUg6">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
</block>
</value>
<statement name="DO0">
<block type="display_set_status_indicator_active" id="Ww635DJHs-2,9@fBZu9/">
<field name="instance_name">txt_status_indicator</field>
<value name="value">
<shadow type="logic_boolean" id="s!o7kCrLWWC$?^d(9y8B">
<field name="BOOL">FALSE</field>
</shadow>
</value>
<next>
<block type="variables_set" id="X3`Pc0WcQIxOYjMp|Mb?">
<field name="VAR" id="E#)K*ceuQH)cM);bvVSl">iaq</field>
<value name="VALUE">
<block type="math_number" id="K]yL.U4fo#:7+w2$Mc[x">
<field name="NUM">0</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="display_set_status_indicator_active" id="K+gOb^b[TNZ+4CChQSHO">
<field name="instance_name">txt_status_indicator</field>
<value name="value">
<shadow type="logic_boolean" id="WDRQgb`8Xvtjt7Ztpfed">
<field name="BOOL">TRUE</field>
</shadow>
</value>
<next>
<block type="variables_set" id="=ENOyx.]2f.HCie@~QdP">
<field name="VAR" id="E#)K*ceuQH)cM);bvVSl">iaq</field>
<value name="VALUE">
<block type="i2c_environment_sensor_get_iaq" id="mM_#]89u;09P}dCIy;DS">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
<field name="dropdown_event">number</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="variables_set" id="T_slPv%+zMa/4}/9^}=9">
<field name="VAR" id="(lIqPZvC*jYE@#I.!=Wy">h</field>
<block type="variables_set" id="/*`sbu=``h|;*`X9omR;">
<field name="VAR" id="HuRd}q%zRj|l]`0]9+,v">t</field>
<value name="VALUE">
<block type="i2c_environment_sensor_get_humidity" id="6kbvrH9kQDDc/%#bBP6Y">
<block type="i2c_environment_sensor_get_temperature" id="buatR#.x9UN7cRK)|.?5">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
</block>
</value>
<next>
<block type="variables_set" id=".17Gj!~lHCQ!{`z$t^VY">
<field name="VAR" id="|]?yRgy2?Z3VWuPxsG(2">p</field>
<block type="variables_set" id="T_slPv%+zMa/4}/9^}=9">
<field name="VAR" id="(lIqPZvC*jYE@#I.!=Wy">h</field>
<value name="VALUE">
<block type="i2c_environment_sensor_get_pressure" id="ZQ5xtNNap]b;HAlvPg~C">
<block type="i2c_environment_sensor_get_humidity" id="6kbvrH9kQDDc/%#bBP6Y">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
</block>
</value>
<next>
<block type="controls_if" id=";AbpjQ^*B(=Cbs_}5`P^">
<mutation else="1"/>
<value name="IF0">
<block type="i2c_environment_sensor_if_need_calibration" id="3w]@E,omem,lXI6e1}43">
<block type="variables_set" id=".17Gj!~lHCQ!{`z$t^VY">
<field name="VAR" id="|]?yRgy2?Z3VWuPxsG(2">p</field>
<value name="VALUE">
<block type="i2c_environment_sensor_get_pressure" id="ZQ5xtNNap]b;HAlvPg~C">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
</block>
</value>
<statement name="DO0">
<block type="display_set_status_indicator_active" id="hrGuaMM1~|ycsABaqzTC">
<field name="instance_name">txt_status_indicator</field>
<value name="value">
<shadow type="logic_boolean" id="EF9@U_M{mJt=I]i{~;gw">
<field name="BOOL">FALSE</field>
</shadow>
</value>
<next>
<block type="variables_set" id="$zKf:i56.3q]C:6;w5jd">
<field name="VAR" id="E#)K*ceuQH)cM);bvVSl">iaq</field>
<value name="VALUE">
<block type="math_number" id="UnUo~#I:FrR[/FXhAc?b">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="i2c_environment_sensor_calibrate" id="{fUdeV*[@7InWg;*mA{t">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
</block>
</next>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="display_set_status_indicator_active" id="Q9)7!%pEcn%PS~w!NEct">
<field name="instance_name">txt_status_indicator</field>
<value name="value">
<shadow type="logic_boolean" id="/5W]{24TmIZtLx|2edvM">
<field name="BOOL">TRUE</field>
</shadow>
</value>
<next>
<block type="variables_set" id="6y!OREr;*e9O!rr[)?~w">
<field name="VAR" id="E#)K*ceuQH)cM);bvVSl">iaq</field>
<value name="VALUE">
<block type="i2c_environment_sensor_get_iaq" id="T61`Nr@Fv{YVoica!,L_">
<field name="instance_name">TXT_I2C_1_environment_sensor</field>
<field name="dropdown_event">number</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="display_set_label_text" id="k#Rvk*WNhI86n.|091[f">
<field name="instance_name">txt_label_t</field>
......
from lib.controller import *
from lib.display import *
import time
t = None
iaq = None
h = None
p = None
if TXT_I2C_1_environment_sensor.needs_calibration():
TXT_I2C_1_environment_sensor.calibrate()
while True:
if TXT_I2C_1_environment_sensor.needs_calibration():
display.exec_script("txt_status_indicator.active=" + str(False).lower())
iaq = 0
else:
display.exec_script("txt_status_indicator.active=" + str(True).lower())
iaq = TXT_I2C_1_environment_sensor.get_indoor_air_quality_as_number()
t = TXT_I2C_1_environment_sensor.get_temperature()
h = TXT_I2C_1_environment_sensor.get_humidity()
p = TXT_I2C_1_environment_sensor.get_pressure()
display.exec_script("txt_label_t.text='%s'" % str(''.join([str(x) for x in ['t: ', t, ' °C']])))
display.exec_script("txt_label_h.text='%s'" % str(''.join([str(x2) for x2 in [' h: ', h, ' %rH']])))
display.exec_script("txt_label_p.text='%s'" % str(''.join([str(x3) for x3 in [' p: ', p, ' hPa']])))
display.exec_script("txt_label_iaq.text='%s'" % str(' iaq: ' + str(iaq)))
print(''.join([str(x4) for x4 in ['t: ', t, ' °C', ' h: ', h, ' %rH', ' p: ', p, ' hPa', ' iaq: ', iaq]]))
time.sleep(3)
<xml xmlns="https://developers.google.com/blockly/xml" version="2">
<block type="txt2_controller" id="alz77~oN0~@9+5#nF!cL" x="29" y="57">
<mutation Input1="I1" Output1="O1" Motor1="M1" Servo_Motor1="S1" Counter1="C1" I2C1="I2C_1" I2C2="I2C_2" USB1="USB_1"/>
<field name="controller_name">TXT</field>
<field name="Input1">-</field>
<field name="Output1">-</field>
<field name="Motor1">-</field>
<field name="Servo_Motor1">-</field>
<field name="Counter1">-</field>
<field name="I2C1">I2C_1</field>
<field name="I2C2">-</field>
<field name="USB1">-</field>
<value name="I2C1">
<block type="environment_sensor" id="-n0n*qQ4yi;ptNx!5CkT"/>
</value>
</block>
</xml>
\ No newline at end of file
<display version="1"><item class="TXTLabel" name="txt_label_t"><text>t</text><geometry><x>60</x><y>60</y><width>100</width><height>20</height></geometry></item><item class="TXTLabel" name="txt_label_h"><text>h</text><geometry><x>60</x><y>90</y><width>100</width><height>20</height></geometry></item><item class="TXTLabel" name="txt_label_p"><text>p</text><geometry><x>60</x><y>120</y><width>100</width><height>20</height></geometry></item><item class="TXTLabel" name="txt_label_iaq"><text>iaq</text><geometry><x>60</x><y>150</y><width>100</width><height>20</height></geometry></item><item class="StatusIndicator" name="txt_status_indicator"><color>#ff0000</color><active>false</active><geometry><x>30</x><y>10</y><width>20</width><height>20</height></geometry></item><item class="TXTLabel" name="txt_label"><text>BME680 calibrated</text><geometry><x>60</x><y>10</y><width>100</width><height>20</height></geometry></item></display>
\ No newline at end of file
<xml xmlns="https://developers.google.com/blockly/xml" version="9">
<block type="txt4_controller" id="alz77~oN0~@9+5#nF!cL" x="29" y="57">
<mutation>
<arg type="Input" name="Input-0" value="-"/>
<arg type="Output" name="Output-0" value="-"/>
<arg type="Motor" name="Motor-0" value="-"/>
<arg type="Motor" name="Motor-1" value="-"/>
<arg type="Servomotor" name="Servomotor-0" value="-"/>
<arg type="Counter" name="Counter-0" value="-"/>
<arg type="I2C" name="I2C-0" value="I2C_1"/>
<arg type="I2C" name="I2C-1" value="-"/>
<arg type="USB" name="USB-0" value="-"/>
</mutation>
<field name="mode">0</field>
<field name="controller_name">TXT</field>
<field name="Input-0">-</field>
<field name="Output-0">-</field>
<field name="Motor-0">-</field>
<field name="Motor-1">-</field>
<field name="Servomotor-0">-</field>
<field name="Counter-0">-</field>
<field name="I2C-0">I2C_1</field>
<field name="I2C-1">-</field>
<field name="USB-0">-</field>
<value name="I2C-0">
<block type="environment_sensor" id="-n0n*qQ4yi;ptNx!5CkT"/>
</value>
</block>
</xml>
\ No newline at end of file
import fischertechnik.factories as txt_factory
txt_factory.init_controller_factory()
txt_factory.init_i2c_factory()
......
import os
import time
import threading
import ftgui
display = ftgui.fttxt2_gui_connector("app")
display.run()
def display_monitoring():
while display.running():
time.sleep(1)
os._exit(0)
exit()
threading.Thread(target=display_monitoring, daemon=True).start()
// auto generated content from display configuration
import QtQuick 2.2
import QtQuick.Window 2.0
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Extras 1.4
TXTWindow {
Rectangle {
id: rect
color: "grey"
anchors.fill: parent
}
TXTLabel {
id: txt_label_t
text: "t"
font.pixelSize: 24
elide: Text.ElideRight
x: 60
y: 60
width: 100
height: 20
}
TXTLabel {
id: txt_label_h
text: "h"
font.pixelSize: 24
elide: Text.ElideRight
x: 60
y: 90
width: 100
height: 20
}
TXTLabel {
id: txt_label_p
text: "p"
font.pixelSize: 24
elide: Text.ElideRight
x: 60
y: 120
width: 100
height: 20
}
TXTLabel {
id: txt_label_iaq
text: "iaq"
font.pixelSize: 24
elide: Text.ElideRight
x: 60
y: 150
width: 100
height: 20
}
StatusIndicator {
id: txt_status_indicator
color: "#ff0000"
active: false
x: 30
y: 10
width: 20
height: 20
}
TXTLabel {
id: txt_label
text: "BME680 calibrated"
font.pixelSize: 24
elide: Text.ElideRight
x: 60
y: 10
width: 100
height: 20
}
}
<xml type="display" version="2"><item id="2" class="TXTLabel"><name>txt_label_t</name><text>t</text><geometry><x>60</x><y>60</y><width>100</width><height>20</height></geometry></item><item id="3" class="TXTLabel"><name>txt_label_h</name><text>h</text><geometry><x>60</x><y>90</y><width>100</width><height>20</height></geometry></item><item id="4" class="TXTLabel"><name>txt_label_p</name><text>p</text><geometry><x>60</x><y>120</y><width>100</width><height>20</height></geometry></item><item id="5" class="TXTLabel"><name>txt_label_iaq</name><text>iaq</text><geometry><x>60</x><y>150</y><width>100</width><height>20</height></geometry></item><item id="6" class="StatusIndicator"><name>txt_status_indicator</name><color>#ff0000</color><active>false</active><geometry><x>30</x><y>10</y><width>20</width><height>20</height></geometry></item><item id="7" class="TXTLabel"><name>txt_label</name><text>BME680 calibrated</text><geometry><x>60</x><y>10</y><width>100</width><height>20</height></geometry></item></xml>
\ No newline at end of file
import ftgui
from controller import *
import time
t = None
h = None
p = None
iaq = None
gui = ftgui.fttxt2_gui_connector("app")
gui.run()
while True:
t = TXT_I2C_1_environment_sensor.get_temperature()
h = TXT_I2C_1_environment_sensor.get_humidity()
p = TXT_I2C_1_environment_sensor.get_pressure()
if TXT_I2C_1_environment_sensor.needs_calibration():
gui.exec_script("txt_status_indicator.active=" + str(False).lower())
iaq = 0
TXT_I2C_1_environment_sensor.calibrate()
else:
gui.exec_script("txt_status_indicator.active=" + str(True).lower())
iaq = TXT_I2C_1_environment_sensor.get_indoor_air_quality_as_number()
gui.exec_script("txt_label_t.text='%s'" % str(''.join([str(x) for x in ['t: ', t, ' °C']])))
gui.exec_script("txt_label_h.text='%s'" % str(''.join([str(x2) for x2 in [' h: ', h, ' %rH']])))
gui.exec_script("txt_label_p.text='%s'" % str(''.join([str(x3) for x3 in [' p: ', p, ' hPa']])))
gui.exec_script("txt_label_iaq.text='%s'" % str(' iaq: ' + str(iaq)))
print(''.join([str(x4) for x4 in ['t: ', t, ' °C', ' h: ', h, ' %rH', ' p: ', p, ' hPa', ' iaq: ', iaq]]))
time.sleep(3)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment