initial commit with all the stuff
This commit is contained in:
13
.gitattributes
vendored
Normal file
13
.gitattributes
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.fcstd filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.woff filter=lfs diff=lfs merge=lfs -text
|
||||
*.woff2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.eot filter=lfs diff=lfs merge=lfs -text
|
||||
*.dtbo filter=lfs diff=lfs merge=lfs -text
|
||||
zImage* filter=lfs diff=lfs merge=lfs -text
|
||||
*.elf filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.dat filter=lfs diff=lfs merge=lfs -text
|
||||
356
2B+Software/COPYING.linux
Normal file
356
2B+Software/COPYING.linux
Normal file
@@ -0,0 +1,356 @@
|
||||
|
||||
NOTE! This copyright does *not* cover user programs that use kernel
|
||||
services by normal system calls - this is merely considered normal use
|
||||
of the kernel, and does *not* fall under the heading of "derived work".
|
||||
Also note that the GPL below is copyrighted by the Free Software
|
||||
Foundation, but the instance of code that it refers to (the Linux
|
||||
kernel) is copyrighted by me and others who actually wrote it.
|
||||
|
||||
Also note that the only valid version of the GPL as far as the kernel
|
||||
is concerned is _this_ particular version of the license (ie v2, not
|
||||
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
|
||||
|
||||
Linus Torvalds
|
||||
|
||||
----------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
13
2B+Software/app/app.lua
Normal file
13
2B+Software/app/app.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
----------------- Configuration LUA -----------------------
|
||||
--
|
||||
-- Text in ""
|
||||
-- Zahlen ohne ""
|
||||
-- Komentare mit --
|
||||
--
|
||||
-- Achtung Gross/Kleinschreibung ist wichtig !
|
||||
--
|
||||
-----------------------------------------------------------
|
||||
|
||||
app.mqttBroker = {"192.168.9.99",inf="MQTT Broker"};
|
||||
app.mqttRoot = {"pilogi",inf="MQTT Root"};
|
||||
|
||||
45
2B+Software/app/cfg.lua
Normal file
45
2B+Software/app/cfg.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
modules = {"panel","app","locale"};
|
||||
|
||||
---------------- Application module app configuration ---------------
|
||||
|
||||
app = {}
|
||||
require "app"
|
||||
|
||||
function app.apply()
|
||||
print(
|
||||
"<br><b><center>Apply module app !</center></b><br>"..
|
||||
"<center>Damit die Änderungen wirksam werden, musste die Anwendung neu gestartet werden !</center><br>"
|
||||
);
|
||||
os.execute("/root/ctrlapp stop")
|
||||
os.execute("sleep 2")
|
||||
os.execute("/root/ctrlapp start")
|
||||
end
|
||||
|
||||
function app.validate()
|
||||
print("<br><b><center>Validate modlue app !</center></b><br>");
|
||||
end
|
||||
|
||||
---------------- Witty Administration localisation ------------------
|
||||
|
||||
locale = {}
|
||||
require "locale";
|
||||
|
||||
---------------- Witty Administration Tabs configuration ------------
|
||||
|
||||
tabs = {}
|
||||
require "tabs";
|
||||
|
||||
panel = {};
|
||||
require "panel"
|
||||
|
||||
function panel.apply()
|
||||
local mqttBroker = app.mqttBroker[1]
|
||||
local mqttRoot = app.mqttRoot[1]
|
||||
print(
|
||||
"<br><b><center>Apply module panel !</center></b><br>"..
|
||||
"<center>Damit die Änderungen wirksam werden, wird die Konfiguration via MQTT publiziert !</center><br>"
|
||||
);
|
||||
os.execute("mosquitto_pub -h "..mqttBroker.. " -t "..mqttRoot.."/ctrl/cmd/panel/config -m apply")
|
||||
os.execute("sleep 2")
|
||||
os.execute("mosquitto_pub -h "..mqttBroker.. " -t "..mqttRoot.."/ctrl/cmd/panel/config -m publish")
|
||||
end
|
||||
9
2B+Software/app/env.lua
Normal file
9
2B+Software/app/env.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
---------------- Application module app configuration ---------------
|
||||
|
||||
app = {};
|
||||
require "app"
|
||||
|
||||
---------------- Application module locale configuration ---------------
|
||||
|
||||
locale = {};
|
||||
require "locale";
|
||||
12
2B+Software/app/locale.lua
Normal file
12
2B+Software/app/locale.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
----------------- Configuration LUA -----------------------
|
||||
--
|
||||
-- Text in ""
|
||||
-- Zahlen ohne ""
|
||||
-- Komentare mit --
|
||||
--
|
||||
-- Achtung Gross/Kleinschreibung ist wichtig !
|
||||
--
|
||||
-----------------------------------------------------------
|
||||
|
||||
locale.version = {"Version 1.0",inf="Software Version"};
|
||||
|
||||
24
2B+Software/app/mb.lua
Normal file
24
2B+Software/app/mb.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
PLC = require('modbus')
|
||||
socket = require('socket')
|
||||
|
||||
plc = PLC.Modbus("pi_daq",502)
|
||||
|
||||
function setup()
|
||||
if ( plc ) then
|
||||
print("OK")
|
||||
end
|
||||
end
|
||||
|
||||
function loop()
|
||||
if ( plc ) then
|
||||
plc:sync();
|
||||
print(plc:getReal(1))
|
||||
end
|
||||
socket.sleep(0.5)
|
||||
end
|
||||
|
||||
setup()
|
||||
|
||||
while 1 do
|
||||
loop()
|
||||
end
|
||||
66
2B+Software/app/mqtt.lua
Normal file
66
2B+Software/app/mqtt.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
MQTT = require("mosquitto")
|
||||
mqtt = MQTT.new()
|
||||
|
||||
local function errLog(msg)
|
||||
io.stderr:write(msg)
|
||||
end
|
||||
|
||||
local connected = false
|
||||
local broker = "localhost"
|
||||
|
||||
local onMessage = nil
|
||||
local onConnect = nil
|
||||
|
||||
local function publish(topic,msg,retain)
|
||||
retain = retain or false
|
||||
mqtt:publish(topic,msg, qos, retain)
|
||||
end
|
||||
|
||||
local function loop()
|
||||
local ok,err,msg
|
||||
|
||||
if connected then
|
||||
ok,err,msg = mqtt:loop(0)
|
||||
if not ok then
|
||||
errLog("MQTT:\t "..msg.."\n")
|
||||
if onError then onError(1) end
|
||||
connected = false
|
||||
end
|
||||
else
|
||||
ok,err,msg = mqtt:loop(0)
|
||||
if not ok then
|
||||
if onError then onError(2) end
|
||||
errLog("MQTT:\t "..msg.."\n")
|
||||
mqtt:connect(broker,1883,5)
|
||||
errLog("MQTT:\t Reconnect".."\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function subscribe(msg)
|
||||
mqtt:subscribe(msg)
|
||||
end
|
||||
|
||||
mqtt.ON_CONNECT = function()
|
||||
connected = true
|
||||
if onConnect then onConnect() end
|
||||
end
|
||||
|
||||
mqtt.ON_MESSAGE = function(mid, topic, payload)
|
||||
if onMessage then onMessage(mid, topic, payload) end
|
||||
end
|
||||
|
||||
local function begin(hostname)
|
||||
broker = hostname
|
||||
mqtt:connect(broker,1883,5)
|
||||
end
|
||||
|
||||
return {
|
||||
begin = begin;
|
||||
loop = loop;
|
||||
publish = publish;
|
||||
subscribe = subscribe;
|
||||
onConnect = function(callback) onConnect = callback end;
|
||||
onMessage = function(callback) onMessage = callback end;
|
||||
onError = function(callback) onError = callback end;
|
||||
}
|
||||
27
2B+Software/app/panel.lua
Normal file
27
2B+Software/app/panel.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
----------------- Configuration LUA -----------------------
|
||||
--
|
||||
-- Text in ""
|
||||
-- Zahlen ohne ""
|
||||
-- Komentare mit --
|
||||
--
|
||||
-- Achtung Gross/Kleinschreibung ist wichtig !
|
||||
--
|
||||
-----------------------------------------------------------
|
||||
|
||||
panel.Debug = {idx=2,alt={"on","off"},inf="Debug Ausgabe aktivieren, MQTT:-t <mqttRoot>/debug -m off -m on | off"};
|
||||
panel.LabelButtonSend = {"Send",inf="Beschriftung Panel Send, MQTT: -t <mqttRoot>/label/button/send -m 'Send'"};
|
||||
panel.LabelButton_1 = {"Sensor Analog",inf="Beschriftung Panel Button 1, MQTT: -t <mqttRoot>/label/button/0 -m 'Text'"};
|
||||
panel.LabelButton_2 = {"Endpoint Logic",inf="Beschriftung Panel Button 2, MQTT: -t <mqttRoot>/label/button/1 -m 'Text'"};
|
||||
panel.LabelButton_3 = {"Kanal 3",inf="Beschriftung Panel Button 3, MQTT: -t <mqttRoot>/label/button/2 -m 'Text'"};
|
||||
panel.LabelButton_4 = {"Kanal 4",inf="Beschriftung Panel Button 4, MQTT: -t <mqttRoot>/label/button/3 -m 'Text'"};
|
||||
panel.LabelHeader = {"AL01 Datalogger",inf="Beschriftung Ueberschrift, MQTT: -t <mqttRoot>/label/header -m 'Text'"};
|
||||
panel.OptionsSamples = {100.000000,inf="Samples, MQTT: <mqttRoot>/options/samples -m 100"};
|
||||
panel.OptionsXaxisMax = {100.000000,inf="Maximum X-Achse, MQTT: -t <mqttRoot>/options/xaxis/max -m 100"};
|
||||
panel.OptionsXaxisMin = {0.000000,inf="Minimum X-Achse, MQTT: -t <mqttRoot>/options/xaxis/min -m 0"};
|
||||
panel.OptionsXaxis_1_Max = {15.000000,inf="Maximum Y-Achse 1, MQTT: -t <mqttRoot>/options/yaxis/0/max -m 15"};
|
||||
panel.OptionsXaxis_2_Max = {30.000000,inf="Maximum Y-Achse 2, MQTT: -t <mqttRoot>/options/yaxis/1/max -m 30"};
|
||||
panel.OptionsXaxis_2_Min = {0.000000,inf="Minimum Y-Achse 2, MQTT: -t <mqttRoot>/options/yaxis/1/min -m 0"};
|
||||
panel.OptionsYaxis_1_Min = {0.000000,inf="Minimum Y-Achse 1, MQTT: -t <mqttRoot>/options/yaxis/0/min -m 0"};
|
||||
panel.TextSendMessage = {"ping",inf="Beschriftung Panel Button 1, MQTT: -t <mqttRoot>/text/send/message -m 'ping'"};
|
||||
panel.TextSendTopic = {"/ctrl/cmd",inf="Beschriftung Panel Button 1, MQTT: -t <mqttRoot>/text/send/topic -m 'ctrl/cmd'"};
|
||||
|
||||
323
2B+Software/app/run.lua
Normal file
323
2B+Software/app/run.lua
Normal file
@@ -0,0 +1,323 @@
|
||||
-- LUA default run file
|
||||
|
||||
-- LUA default run file
|
||||
|
||||
require "env"
|
||||
|
||||
periphery = require('periphery')
|
||||
Serial = periphery.Serial
|
||||
|
||||
dsr = periphery.GPIO(18,"out")
|
||||
rst = periphery.GPIO(22,"in")
|
||||
|
||||
evdev = require "evdev"
|
||||
touch = evdev.Device("/dev/input/event0")
|
||||
|
||||
socket = require('socket')
|
||||
|
||||
COMMAND_POSITION = 0x19
|
||||
COMMAND_POSITION_X = 0x13
|
||||
COMMAND_POSITION_Y = 0x11
|
||||
|
||||
COMMAND_HOME = 0x0C
|
||||
|
||||
COMMAND_PASSWORD = 0x7F
|
||||
|
||||
COMMAND_01H = 0x01
|
||||
COMMAND_03H = 0x03
|
||||
|
||||
COMMAND_CURSOR_ON = 0x0F
|
||||
COMMAND_CURSOR_OFF = 0x0E
|
||||
|
||||
COMMAND_BLINK = 0x0B
|
||||
COMMAND_UNBLINK = 0x0C
|
||||
|
||||
COMMAND_CR = 0x0D
|
||||
COMMAND_LF = 0x0A
|
||||
|
||||
blinkFlag = false
|
||||
|
||||
posX = 0
|
||||
posY = 0
|
||||
|
||||
touchY = 0
|
||||
touchX = 0
|
||||
|
||||
LOGING = 1
|
||||
-- 1 2 3 4 5 6 7 8 9 10
|
||||
-- 11 12 13 14 15 16 17 18 19 20
|
||||
controlLabels = {"<-" ,"<<" ,"^" ,"^^" ,"vv" , "v" ,">>" ,"->" ,"Help" ,"Del",
|
||||
"Done" ," " ,"Insert","," ,"Space" , " " ,"=" ,"Remove","Enter" ," "}
|
||||
controlFonts = {"C" ,"C" ,"C" ,"C" ,"C" , "C" ,"C" ,"C" ,"T" ,"C",
|
||||
"C" ,"T" ,"T" ,"C" ,"C" , "T" ,"C" ,"T" ,"C" ,"T"}
|
||||
controlPos = {{02,06}, {01,18}, {02,02}, {01,30}, {01,22}, {18,02}, {01,34}, {02,44}, {02,10}, {02,50},
|
||||
{10,01}, {10,01}, {06,01}, {10,50}, {14,50}, {14,50}, {06,50}, {15,02}, {18,50}, {18,50}}
|
||||
|
||||
local function errLog(msg)
|
||||
io.stderr:write(msg)
|
||||
end
|
||||
|
||||
function logPrint(msg,aux)
|
||||
if ( LOGING ) then
|
||||
if aux then
|
||||
print(msg.." , "..aux)
|
||||
else
|
||||
print(msg);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function dbgPrint(msg,aux)
|
||||
if ( DEBUG ) then
|
||||
if aux then
|
||||
print(msg.." , "..aux)
|
||||
else
|
||||
print(msg);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function checkY(y)
|
||||
if y < 0 then
|
||||
y = 0
|
||||
end
|
||||
if y > 5 then
|
||||
y = 5
|
||||
end
|
||||
posY = y
|
||||
return y
|
||||
end
|
||||
|
||||
function checkX(x)
|
||||
if x < 0 then
|
||||
x = 39;
|
||||
posY = posY - 1
|
||||
checkY(posY)
|
||||
end
|
||||
if x > 39 then
|
||||
if posY == 5 then
|
||||
x = 39;
|
||||
else
|
||||
x = 0;
|
||||
posY = posY + 1
|
||||
checkY(posY);
|
||||
end
|
||||
end
|
||||
posX = x
|
||||
return x
|
||||
end
|
||||
|
||||
function gotoXY(x,y)
|
||||
checkX(x);
|
||||
checkY(y);
|
||||
end
|
||||
|
||||
function lineFeed(void)
|
||||
posY = posY + 1
|
||||
gotoXY(posX, checkY(posY));
|
||||
end
|
||||
|
||||
function carriageReturn(void)
|
||||
gotoXY(0, posY);
|
||||
end
|
||||
|
||||
function clearAndHome(void)
|
||||
for i=1, 6, 1 do
|
||||
for j=1, 40, 1 do
|
||||
line[i][j]:setTextColor(HMI.Color.green);
|
||||
line[i][j]:setBackground(HMI.Color.black);
|
||||
line[i][j]:setText(" ")
|
||||
line[i][j]:draw()
|
||||
end
|
||||
end
|
||||
posX = 0
|
||||
posY = 0
|
||||
end
|
||||
|
||||
|
||||
function doRead()
|
||||
local timestamp = socket.gettime()*1000
|
||||
|
||||
while socket.gettime()*1000 - timestamp < 10 do
|
||||
if serial:poll(0.01) then
|
||||
local c = serial:read(1)
|
||||
if c:byte() == COMMAND_POSITION then
|
||||
local cmd = serial:read(1)
|
||||
if cmd:byte() == COMMAND_POSITION_X then
|
||||
local x = string.byte(serial:read(1))
|
||||
gotoXY(x,posY)
|
||||
elseif cmd:byte() == COMMAND_POSITION_Y then
|
||||
local y = string.byte(serial:read(1))
|
||||
gotoXY(posX,y)
|
||||
elseif cmd:byte() == COMMAND_HOME then
|
||||
clearAndHome();
|
||||
end
|
||||
elseif c:byte() == COMMAND_03H then
|
||||
serial:read(1)
|
||||
serial:read(1)
|
||||
elseif c:byte() == COMMAND_BLINK then
|
||||
blinkFlag = true
|
||||
elseif c:byte() == COMMAND_UNBLINK then
|
||||
blinkFlag = false
|
||||
elseif c:byte() == COMMAND_CURSOR_OFF then
|
||||
-- curs_set(0);
|
||||
elseif c:byte() == COMMAND_CURSOR_ON then
|
||||
-- curs_set(0);
|
||||
elseif c:byte() == COMMAND_CR then
|
||||
carriageReturn()
|
||||
elseif c:byte() == COMMAND_LF then
|
||||
lineFeed()
|
||||
else
|
||||
if c:byte() == COMMAND_PASSWORD then
|
||||
c = '*'
|
||||
end
|
||||
|
||||
if c:byte() >= 0x20 and c:byte() < 0x7F then
|
||||
--print(c.." at "..posX.." "..posY.."\n")
|
||||
local label = line[posY+1][posX+1]
|
||||
label:setText(c)
|
||||
if blinkFlag then
|
||||
label:setTextColor(HMI.Color.black);
|
||||
label:setBackground(HMI.Color.green);
|
||||
else
|
||||
label:setTextColor(HMI.Color.green);
|
||||
label:setBackground(HMI.Color.black);
|
||||
end
|
||||
posX = posX + 1
|
||||
checkX(posX)
|
||||
label:draw()
|
||||
else
|
||||
print("Unknown: "..c:byte().."\n");
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function doTouch()
|
||||
local x = 0;
|
||||
local y = 0;
|
||||
if touch:avail() > 0 then
|
||||
local timestamp, eventType, eventCode, value = touch:read()
|
||||
if eventType == evdev.EV_ABS then
|
||||
if eventCode == 53 then
|
||||
touchX = value
|
||||
elseif eventCode == 54 then
|
||||
touchY = value
|
||||
end
|
||||
end
|
||||
if eventType == 1 then
|
||||
if eventCode == 330 then
|
||||
if touchY > 0 and touchY < 79 then
|
||||
idx = math.floor(touchX/80)+1
|
||||
x = controlPos[idx][2]
|
||||
y = controlPos[idx][1]
|
||||
print("Ctrl1: ",y,x,idx)
|
||||
end
|
||||
if touchY > 400 and touchY < 479 then
|
||||
idx = math.floor(touchX/80)+11
|
||||
x = controlPos[idx][2]
|
||||
y = controlPos[idx][1]
|
||||
print("Ctrl2: ",y,x,idx)
|
||||
end
|
||||
if touchY > 320 and touchY < 399 then
|
||||
x = 8 + math.floor(touchX/80)*4
|
||||
y = 19
|
||||
print("Numbs: ",y,x)
|
||||
end
|
||||
if touchY > 80 and touchY < 319 then
|
||||
y = math.floor((touchY-80)/240*10+6)
|
||||
x = math.floor(touchX/720*36+7)
|
||||
print("Lines: ",y,x)
|
||||
end
|
||||
if x > 0 and y > 0 then
|
||||
if value == 1 then
|
||||
print("down")
|
||||
serial:write(string.char(0x5F,y,x))
|
||||
serial:flush()
|
||||
--serial:write(string.char(0x5F,x,y))
|
||||
else
|
||||
print("up")
|
||||
serial:write(string.char(0x6F,y,x))
|
||||
serial:flush()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function setup()
|
||||
serial = Serial{device="/dev/ttyAMA0", baudrate=9600, databits=7, parity="odd", stopbits=1}
|
||||
instance = HMI.App.instance;
|
||||
layout = HMI.Layout(instance,200,48);
|
||||
|
||||
monoChar = HMI.Font("/root/font/mono.ttf",34)
|
||||
monoText = HMI.Font("/root/font/mono.ttf",20)
|
||||
|
||||
dsr:write(true)
|
||||
socket.sleep(1)
|
||||
dsr:write(false)
|
||||
|
||||
line = {}
|
||||
for i=1, 6, 1 do
|
||||
line[i] = {}
|
||||
for j=1, 40, 1 do
|
||||
line[i][j] = HMI.Label(layout,5*(j-1),8+4*(i-1),5,4," ");
|
||||
line[i][j]:setTextColor(HMI.Color.green);
|
||||
line[i][j]:setBackground(HMI.Color.black);
|
||||
line[i][j]:setFont(monoChar)
|
||||
line[i][j]:draw()
|
||||
end
|
||||
end
|
||||
|
||||
number = {}
|
||||
for i=1, 10, 1 do
|
||||
number[i] = HMI.Cell(layout,1+20*(i-1),34,20,7,i-1);
|
||||
number[i]:setTextColor(HMI.Color.black);
|
||||
number[i]:setBackground(HMI.Color.white);
|
||||
number[i]:setFont(monoChar)
|
||||
end
|
||||
|
||||
control = {}
|
||||
for j=0, 1, 1 do
|
||||
for i=1, 10, 1 do
|
||||
local idx = i+j*10
|
||||
if idx ~= 12 and idx ~= 16 and idx ~= 20 then
|
||||
if idx == 11 or idx == 15 or idx == 19 then
|
||||
control[idx] = HMI.Cell(layout,1+20*(i-1),j*41,40,7,i-1);
|
||||
else
|
||||
control[idx] = HMI.Cell(layout,1+20*(i-1),j*41,20,7,i-1);
|
||||
end
|
||||
if controlLabels[idx] then
|
||||
control[idx]:setText(controlLabels[idx])
|
||||
end
|
||||
control[idx]:setTextColor(HMI.Color.black);
|
||||
control[idx]:setBackground(HMI.Color.grey);
|
||||
if controlFonts[idx] == 'T' then
|
||||
control[idx]:setFont(monoText)
|
||||
else
|
||||
control[i+j*10]:setFont(monoChar)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
cnt = 0;
|
||||
end
|
||||
|
||||
function loop()
|
||||
doRead()
|
||||
doTouch()
|
||||
if not rst:read() then
|
||||
print("rst")
|
||||
dsr:write(true)
|
||||
socket.sleep(1)
|
||||
dsr:write(false)
|
||||
end
|
||||
end
|
||||
|
||||
io.stderr:write("Run LUA\n");
|
||||
|
||||
--------------------------------------------------
|
||||
|
||||
114
2B+Software/app/run_line.lua
Normal file
114
2B+Software/app/run_line.lua
Normal file
@@ -0,0 +1,114 @@
|
||||
-- LUA default run file
|
||||
|
||||
-- LUA default run file
|
||||
|
||||
require "env"
|
||||
MQTT = require("mqtt")
|
||||
Scheduler = require('scheduler')
|
||||
|
||||
LOGING = 1
|
||||
|
||||
local function errLog(msg)
|
||||
io.stderr:write(msg)
|
||||
end
|
||||
|
||||
function logPrint(msg,aux)
|
||||
if ( LOGING ) then
|
||||
if aux then
|
||||
print(msg.." , "..aux)
|
||||
else
|
||||
print(msg);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function dbgPrint(msg,aux)
|
||||
if ( DEBUG ) then
|
||||
if aux then
|
||||
print(msg.." , "..aux)
|
||||
else
|
||||
print(msg);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MQTT.onConnect (
|
||||
function()
|
||||
errLog("MQTT:\t Connect\n");
|
||||
MQTT.subscribe("+/#")
|
||||
end
|
||||
)
|
||||
|
||||
MQTT.onMessage (
|
||||
function(mid, topic, payload)
|
||||
logPrint("MQTT:\t Message <"..topic..">", payload)
|
||||
--posY,posX,strData,attrData = string.match(payload,"(%d+)|(%d+)|([^|])|([^|])")
|
||||
posY,posX,rawData = string.match(payload,"(%d+)|(%d+)|(.+)")
|
||||
strData=string.sub(rawData,1,string.len(rawData)/2)
|
||||
attrData=string.sub(rawData,string.len(rawData)/2+1)
|
||||
print(posY.."|"..posX.."|"..strData.."|"..attrData.."\n")
|
||||
if posY and posX and strData then
|
||||
line[posY+1]:setText(strData);
|
||||
line[posY+1]:draw()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
function setup()
|
||||
|
||||
if app.mqttBroker then
|
||||
MQTT.begin(app.mqttBroker[1])
|
||||
end
|
||||
MQTT.loop()
|
||||
|
||||
instance = HMI.App.instance;
|
||||
layout = HMI.Layout(instance,200,48);
|
||||
|
||||
mono = HMI.Font("/root/font/mono.ttf",34)
|
||||
|
||||
line = {}
|
||||
for i=1, 6, 1 do
|
||||
line[i] = HMI.Label(layout,0,8+4*(i-1),200,4,"1234567890123456789012345678901234567890");
|
||||
line[i]:setTextColor(HMI.Color.green);
|
||||
line[i]:setBackground(HMI.Color.black);
|
||||
line[i]:setFont(mono)
|
||||
end
|
||||
|
||||
number = {}
|
||||
for i=1, 10, 1 do
|
||||
number[i] = HMI.Cell(layout,1+20*(i-1),0,20,7,i-1);
|
||||
number[i]:setTextColor(HMI.Color.black);
|
||||
number[i]:setBackground(HMI.Color.grey);
|
||||
number[i]:setFont(mono)
|
||||
end
|
||||
|
||||
control = {}
|
||||
for j=0, 1, 1 do
|
||||
for i=1, 10, 1 do
|
||||
control[i+j] = HMI.Cell(layout,1+20*(i-1),34+j*7,20,7,i-1);
|
||||
control[i+j]:setTextColor(HMI.Color.black);
|
||||
control[i+j]:setBackground(HMI.Color.grey);
|
||||
control[i+j]:setFont(mono)
|
||||
end
|
||||
end
|
||||
|
||||
updateTimer = Scheduler.Timer(500)
|
||||
cnt = 0;
|
||||
end
|
||||
|
||||
function loop()
|
||||
--[[
|
||||
if updateTimer.elapsed() then
|
||||
line[1]:setText(string.format("%5.2f",cnt))
|
||||
line[1]:draw()
|
||||
cnt = cnt + 1
|
||||
updateTimer.restart()
|
||||
end
|
||||
--]]
|
||||
MQTT.loop()
|
||||
end
|
||||
|
||||
io.stderr:write("Run LUA\n");
|
||||
|
||||
--------------------------------------------------
|
||||
|
||||
289
2B+Software/app/run_logi.lua
Normal file
289
2B+Software/app/run_logi.lua
Normal file
@@ -0,0 +1,289 @@
|
||||
-- LUA default run file
|
||||
|
||||
-- LUA default run file
|
||||
|
||||
require "env"
|
||||
panel = {}
|
||||
require "panel"
|
||||
|
||||
socket = require('socket')
|
||||
PLC = require('vwago')
|
||||
Scheduler = require('scheduler')
|
||||
--I2CClass = require('periphery').I2C
|
||||
I2CDevice = nil;
|
||||
MQTT = require("mqtt")
|
||||
|
||||
daq = {};
|
||||
|
||||
local function errLog(msg)
|
||||
io.stderr:write(msg)
|
||||
end
|
||||
|
||||
function logPrint(msg)
|
||||
print(msg);
|
||||
end
|
||||
|
||||
local function pubPanelConfig()
|
||||
MQTT.publish(mqttRoot.."/panel/label/button/send",panel.LabelButtonSend[1])
|
||||
MQTT.publish(mqttRoot.."/panel/label/button/0",panel.LabelButton_1[1])
|
||||
MQTT.publish(mqttRoot.."/panel/label/button/1",panel.LabelButton_2[1])
|
||||
MQTT.publish(mqttRoot.."/panel/label/button/2",panel.LabelButton_3[1])
|
||||
MQTT.publish(mqttRoot.."/panel/label/button/3",panel.LabelButton_4[1])
|
||||
MQTT.publish(mqttRoot.."/panel/label/header",panel.LabelHeader[1])
|
||||
MQTT.publish(mqttRoot.."/panel/options/samples",panel.OptionsSamples[1])
|
||||
MQTT.publish(mqttRoot.."/panel/options/xaxis/max",panel.OptionsXaxisMax[1])
|
||||
MQTT.publish(mqttRoot.."/panel/options/xaxis/min",panel.OptionsXaxisMin[1])
|
||||
MQTT.publish(mqttRoot.."/panel/options/yaxis/0/max",panel.OptionsXaxis_1_Max[1])
|
||||
MQTT.publish(mqttRoot.."/panel/options/yaxis/1/max",panel.OptionsXaxis_2_Max[1])
|
||||
MQTT.publish(mqttRoot.."/panel/options/yaxis/1/min",panel.OptionsXaxis_2_Min[1])
|
||||
MQTT.publish(mqttRoot.."/panel/options/yaxis/0/min",panel.OptionsYaxis_1_Min[1])
|
||||
MQTT.publish(mqttRoot.."/panel/text/send/message", panel.TextSendMessage[1])
|
||||
MQTT.publish(mqttRoot.."/panel/text/send/topic",panel.TextSendTopic[1])
|
||||
MQTT.publish(mqttRoot.."/panel/debug",panel.Debug["alt"][panel.Debug["idx"]])
|
||||
end
|
||||
|
||||
MQTT.onConnect (
|
||||
function()
|
||||
errLog("MQTT:\t Connect\n");
|
||||
MQTT.publish(mqttRoot.."/info", "PIALU")
|
||||
MQTT.subscribe(mqttRoot.."/ctrl/#")
|
||||
end
|
||||
)
|
||||
|
||||
MQTT.onMessage (
|
||||
function(mid, topic, payload)
|
||||
logPrint("MQTT:\t Message "..topic, payload)
|
||||
|
||||
subTopic = string.match(topic,mqttRoot.."/ctrl/(%w+)")
|
||||
if subTopic then
|
||||
if subTopic == "cmd" then
|
||||
logPrint("MQTT:\t Command");
|
||||
analogChannel = string.match(topic,mqttRoot.."/ctrl/cmd/analog/(%w)")
|
||||
if analogChannel then
|
||||
|
||||
if analogChannel == "0" then
|
||||
logPrint("MQTT:\t Command Analog Channel "..analogChannel.." "..payload);
|
||||
if payload == "on" then
|
||||
channel_0 = true
|
||||
MQTT.publish(mqttRoot.."/status/analog/0", "on",true)
|
||||
else
|
||||
channel_0 = false
|
||||
MQTT.publish(mqttRoot.."/status/analog/0", "off",true)
|
||||
end
|
||||
elseif analogChannel == "1" then
|
||||
if payload == "on" then
|
||||
channel_1 = true
|
||||
MQTT.publish(mqttRoot.."/status/analog/1", "on",true)
|
||||
else
|
||||
channel_1 = false
|
||||
MQTT.publish(mqttRoot.."/status/analog/1", "off",true)
|
||||
end
|
||||
elseif analogChannel == "2" then
|
||||
if payload == "on" then
|
||||
channel_2 = true
|
||||
MQTT.publish(mqttRoot.."/status/analog/2", "on",true)
|
||||
else
|
||||
channel_2 = false
|
||||
MQTT.publish(mqttRoot.."/status/analog/2", "off",true)
|
||||
end
|
||||
elseif analogChannel == "3" then
|
||||
if payload == "on" then
|
||||
channel_3 = true
|
||||
MQTT.publish(mqttRoot.."/status/analog/3", "on",true)
|
||||
else
|
||||
channel_3 = false
|
||||
MQTT.publish(mqttRoot.."/status/analog/3", "off",true)
|
||||
end
|
||||
end
|
||||
elseif string.match(topic,mqttRoot.."/ctrl/cmd/panel/config") then
|
||||
if string.match(payload,"publish") then
|
||||
pubPanelConfig()
|
||||
elseif string.match(payload,"apply") then
|
||||
panel = {}
|
||||
dofile("panel.lua")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
local function getInt32(bytes,offset)
|
||||
if (offset >= 0) and ((#bytes-offset) >= 4) then
|
||||
num = bytes[offset+1] + bit32.lshift(bytes[offset+2],8) + bit32.lshift(bytes[offset+3],16) + bit32.lshift(bytes[offset+4],24);
|
||||
if ( num > 0x80000000 ) then
|
||||
return num - 0x100000000;
|
||||
else
|
||||
return num;
|
||||
end
|
||||
end
|
||||
|
||||
return 9999999999;
|
||||
end
|
||||
|
||||
local function getInt16(bytes,offset)
|
||||
if (offset >= 0) and ((#bytes-offset) >= 2) then
|
||||
num = bytes[offset+1] + bit32.lshift(bytes[offset+2],8);
|
||||
end
|
||||
|
||||
if ( num > 0x8000 ) then
|
||||
return num - 0x10000;
|
||||
else
|
||||
return num;
|
||||
end
|
||||
|
||||
return 9999999999;
|
||||
end
|
||||
|
||||
local function getUint8(bytes,offset)
|
||||
if (offset >= 0) and ((#bytes-offset) >= 1) then
|
||||
return bytes[offset+1];
|
||||
end
|
||||
|
||||
return 999999999;
|
||||
end
|
||||
--[[
|
||||
local function i2cBegin()
|
||||
I2CDevice = I2CClass("/dev/i2c-1")
|
||||
end
|
||||
|
||||
local function i2cRecvMsg()
|
||||
local msg = {{
|
||||
0x00, -- uint8_t hartbeat;
|
||||
0x00, 0x00, 0x00, 0x00, -- int32_t data_32;
|
||||
0x00, 0x00, 0x00, 0x00, -- int32_t data_32;
|
||||
0x00, 0x00, 0x00, 0x00, -- int32_t data_32;
|
||||
0x00, 0x00, 0x00, 0x00, -- int32_t data_32;
|
||||
flags = I2CClass.I2C_M_RD
|
||||
}}
|
||||
I2CDevice:transfer(6, msg)
|
||||
-- print(table.unpack(msg[1]));
|
||||
return msg[1]
|
||||
end
|
||||
|
||||
local function i2cSendMsg(cmd)
|
||||
local msg = {{cmd, 0x00, 0x00, 0x00, 0x00, flags = 0}}
|
||||
I2CDevice:transfer(4, msg)
|
||||
end
|
||||
--]]
|
||||
local function recv()
|
||||
--[[
|
||||
daqData = i2cRecvMsg();
|
||||
-- print(table.unpack(daqData));
|
||||
daq.hartbeat = getUint8(daqData,0);
|
||||
daq.sum0 = getInt32(daqData,1);
|
||||
daq.sum1 = getInt32(daqData,5);
|
||||
daq.sum2 = getInt32(daqData,9);
|
||||
daq.sum3 = getInt32(daqData,13);
|
||||
--]]
|
||||
daq.hartbeat = 123;
|
||||
daq.sum0 = 3;
|
||||
daq.sum1 = 1.7;
|
||||
daq.sum2 = 9;
|
||||
daq.sum3 = 5.5;
|
||||
end
|
||||
|
||||
function setup()
|
||||
mqttBroker = app.mqttBroker[1]
|
||||
mqttRoot = app.mqttRoot[1]
|
||||
|
||||
instance = HMI.App.instance;
|
||||
layout = HMI.Layout(instance,32,24);
|
||||
|
||||
label = HMI.Label(layout,0,0,32,3,"Plot");
|
||||
label:setTextColor(HMI.Color.white);
|
||||
label:setBackground(HMI.Color.blue);
|
||||
|
||||
chart = HMI.Timechart(layout,0,4,32,16)
|
||||
chart:setBaseline(0)
|
||||
chart:setValuePerDivison(2)
|
||||
chart:setSamplesPerDivison(20)
|
||||
chart:setSamplesFormat("%d Samples/Div, Samplerate 0.5s <=> 10 Sekunden/Div")
|
||||
|
||||
txt0 = HMI.Label(layout, 1,20,6,2,"Ch 0");
|
||||
txt0:getTextObject():setAlign(HMI.ALIGN_LEFT);
|
||||
txt1 = HMI.Label(layout,17,20,6,2,"Ch 1");
|
||||
txt1:getTextObject():setAlign(HMI.ALIGN_LEFT);
|
||||
txt2 = HMI.Label(layout, 1,22,6,2,"Ch 2");
|
||||
txt2:getTextObject():setAlign(HMI.ALIGN_LEFT);
|
||||
txt3 = HMI.Label(layout,17,22,6,2,"Ch 3");
|
||||
txt3:getTextObject():setAlign(HMI.ALIGN_LEFT);
|
||||
|
||||
out0 = HMI.Output(layout, 7,20,6,2,"0000");
|
||||
out1 = HMI.Output(layout,23,20,6,2,"0000");
|
||||
out2 = HMI.Output(layout, 7,22,6,2,"0000");
|
||||
out3 = HMI.Output(layout,23,22,6,2,"0000");
|
||||
|
||||
updateTimer = Scheduler.Timer(500)
|
||||
|
||||
-- i2cBegin()
|
||||
|
||||
if mqttBroker then
|
||||
errLog("MQTT:\t Begin\n");
|
||||
MQTT.begin(mqttBroker)
|
||||
end
|
||||
|
||||
MQTT.loop()
|
||||
|
||||
channel_0 = true;
|
||||
channel_1 = true;
|
||||
channel_2 = true;
|
||||
channel_3 = true;
|
||||
|
||||
MQTT.publish(mqttRoot.."/status/analog/0", "on",true)
|
||||
MQTT.publish(mqttRoot.."/status/analog/1", "on",true)
|
||||
MQTT.publish(mqttRoot.."/status/analog/2", "on",true)
|
||||
MQTT.publish(mqttRoot.."/status/analog/3", "on",true)
|
||||
end
|
||||
|
||||
function loop()
|
||||
MQTT.loop()
|
||||
|
||||
if updateTimer.elapsed() then
|
||||
updateTimer.restart()
|
||||
recv()
|
||||
|
||||
val0 = daq.sum0*0.0000707750682632
|
||||
val1 = daq.sum1*0.0000707750682632
|
||||
val2 = daq.sum2*0.0000208350713273
|
||||
val3 = daq.sum3*0.0000208350713273
|
||||
|
||||
out0:setText(string.format("%5.2f",val0))
|
||||
out1:setText(string.format("%5.2f",val1))
|
||||
out2:setText(string.format("%5.2f",val2))
|
||||
out3:setText(string.format("%5.2f",val3))
|
||||
chart:plot(daq.sum0*0.0000707750682632)
|
||||
--chart:plot(daq.sum1*0.0000707750682632)
|
||||
--chart:plot(daq.sum2*0.0000208350713273)
|
||||
--chart:plot(daq.sum3*0.0000208350713273)
|
||||
|
||||
compound = ""
|
||||
|
||||
if channel_0 then
|
||||
MQTT.publish(mqttRoot.."/analog/0",val0)
|
||||
compound = compound..",0:"..val0
|
||||
end
|
||||
if channel_1 then
|
||||
MQTT.publish(mqttRoot.."/analog/1",val1)
|
||||
compound = compound..",1:"..val1
|
||||
end
|
||||
if channel_2 then
|
||||
MQTT.publish(mqttRoot.."/analog/2",val2)
|
||||
compound = compound..",2:"..val2
|
||||
end
|
||||
if channel_3 then
|
||||
MQTT.publish(mqttRoot.."/analog/3",val3)
|
||||
compound = compound..",3:"..val3
|
||||
end
|
||||
all = string.sub(compound,2)
|
||||
if string.len(all) > 0 then
|
||||
MQTT.publish(mqttRoot.."/analog/all",all)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
io.stderr:write("Run LUA\n");
|
||||
|
||||
--------------------------------------------------
|
||||
|
||||
130
2B+Software/app/run_mqtt.lua
Normal file
130
2B+Software/app/run_mqtt.lua
Normal file
@@ -0,0 +1,130 @@
|
||||
-- LUA default run file
|
||||
|
||||
-- LUA default run file
|
||||
|
||||
require "env"
|
||||
MQTT = require("mqtt")
|
||||
Scheduler = require('scheduler')
|
||||
|
||||
LOGING = 1
|
||||
|
||||
local function errLog(msg)
|
||||
io.stderr:write(msg)
|
||||
end
|
||||
|
||||
function logPrint(msg,aux)
|
||||
if ( LOGING ) then
|
||||
if aux then
|
||||
print(msg.." , "..aux)
|
||||
else
|
||||
print(msg);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function dbgPrint(msg,aux)
|
||||
if ( DEBUG ) then
|
||||
if aux then
|
||||
print(msg.." , "..aux)
|
||||
else
|
||||
print(msg);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MQTT.onConnect (
|
||||
function()
|
||||
errLog("MQTT:\t Connect\n");
|
||||
MQTT.subscribe("+/#")
|
||||
end
|
||||
)
|
||||
|
||||
MQTT.onMessage (
|
||||
function(mid, topic, payload)
|
||||
logPrint("MQTT:\t Message <"..topic..">", payload)
|
||||
--posY,posX,strData,attrData = string.match(payload,"(%d+)|(%d+)|([^|])|([^|])")
|
||||
posY,posX,rawData = string.match(payload,"(%d+)|(%d+)|(.+)")
|
||||
strData=string.sub(rawData,1,string.len(rawData)/2)
|
||||
attrData=string.sub(rawData,string.len(rawData)/2+2)
|
||||
print(posY.."|"..posX.."|"..strData.."|"..attrData.."\n")
|
||||
if posY and posX and strData and attrData then
|
||||
local len = string.len(strData)
|
||||
for j=1, len, 1 do
|
||||
local label = line[posY+1][posX+j]
|
||||
if attrData:sub(j,j) == 'b' then
|
||||
label:setTextColor(HMI.Color.black);
|
||||
label:setBackground(HMI.Color.green);
|
||||
else
|
||||
label:setTextColor(HMI.Color.green);
|
||||
label:setBackground(HMI.Color.black);
|
||||
end
|
||||
label:setText(strData:sub(j,j))
|
||||
label:draw()
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
function setup()
|
||||
|
||||
if app.mqttBroker then
|
||||
MQTT.begin(app.mqttBroker[1])
|
||||
end
|
||||
MQTT.loop()
|
||||
|
||||
instance = HMI.App.instance;
|
||||
layout = HMI.Layout(instance,200,48);
|
||||
|
||||
mono = HMI.Font("/root/font/mono.ttf",34)
|
||||
|
||||
line = {}
|
||||
for i=1, 6, 1 do
|
||||
line[i] = {}
|
||||
for j=1, 40, 1 do
|
||||
line[i][j] = HMI.Label(layout,5*(j-1),8+4*(i-1),5,4,j%10);
|
||||
-- line[i] = HMI.Label(layout,0,8+4*(i-1),200,4,"1234567890123456789012345678901234567890");
|
||||
line[i][j]:setTextColor(HMI.Color.green);
|
||||
line[i][j]:setBackground(HMI.Color.black);
|
||||
line[i][j]:setFont(mono)
|
||||
line[1][j]:draw()
|
||||
end
|
||||
end
|
||||
|
||||
number = {}
|
||||
for i=1, 10, 1 do
|
||||
number[i] = HMI.Cell(layout,1+20*(i-1),0,20,7,i-1);
|
||||
number[i]:setTextColor(HMI.Color.black);
|
||||
number[i]:setBackground(HMI.Color.grey);
|
||||
number[i]:setFont(mono)
|
||||
end
|
||||
|
||||
control = {}
|
||||
for j=0, 1, 1 do
|
||||
for i=1, 10, 1 do
|
||||
control[i+j] = HMI.Cell(layout,1+20*(i-1),34+j*7,20,7,i-1);
|
||||
control[i+j]:setTextColor(HMI.Color.black);
|
||||
control[i+j]:setBackground(HMI.Color.grey);
|
||||
control[i+j]:setFont(mono)
|
||||
end
|
||||
end
|
||||
|
||||
updateTimer = Scheduler.Timer(500)
|
||||
cnt = 0;
|
||||
end
|
||||
|
||||
function loop()
|
||||
--[[
|
||||
if updateTimer.elapsed() then
|
||||
line[1]:setText(string.format("%5.2f",cnt))
|
||||
line[1]:draw()
|
||||
cnt = cnt + 1
|
||||
updateTimer.restart()
|
||||
end
|
||||
--]]
|
||||
MQTT.loop()
|
||||
end
|
||||
|
||||
io.stderr:write("Run LUA\n");
|
||||
|
||||
--------------------------------------------------
|
||||
|
||||
50
2B+Software/app/scheduler.lua
Normal file
50
2B+Software/app/scheduler.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
local scheduler = {}
|
||||
|
||||
socket = require('socket')
|
||||
|
||||
function scheduler.Timer(init)
|
||||
-- the new instance
|
||||
|
||||
local self = {
|
||||
-- public fields go in the instance table
|
||||
interval = init
|
||||
}
|
||||
|
||||
local function millis()
|
||||
return socket.gettime()*1000
|
||||
end
|
||||
|
||||
-- private fields are implemented using locals
|
||||
-- they are faster than table access, and are truly private,
|
||||
-- so the code that uses your class can't get them
|
||||
|
||||
local _timestamp = millis()
|
||||
local _running = true
|
||||
|
||||
function self.elapsed()
|
||||
if _running and (millis() - _timestamp ) >= self.interval then
|
||||
_running = false
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function self.running()
|
||||
return (millis() - _timestamp ) < self.interval
|
||||
end
|
||||
|
||||
function self.restart()
|
||||
_timestamp = millis()
|
||||
_running = true
|
||||
end
|
||||
|
||||
function self.count()
|
||||
return millis() - timestamp
|
||||
end
|
||||
|
||||
-- return the instance
|
||||
return self
|
||||
end
|
||||
|
||||
return scheduler
|
||||
599
2B+Software/app/secs.lua
Normal file
599
2B+Software/app/secs.lua
Normal file
@@ -0,0 +1,599 @@
|
||||
---------------------------- SECS I / SECS II ----------------------------------
|
||||
periphery = require('periphery')
|
||||
|
||||
Serial = periphery.Serial
|
||||
Scheduler = require('scheduler')
|
||||
|
||||
struct = require('struct')
|
||||
|
||||
local ASCII_EOT = "\x04" -- end of transmission
|
||||
local ASCII_ENQ = "\x05" -- enquiary
|
||||
local ASCII_ACK = "\x06" -- acknowledge
|
||||
local ASCII_NAK = "\x15" -- negative acknowledge
|
||||
|
||||
local SF_LIST = 0x00
|
||||
local SF_NITEMS = 0x1F
|
||||
local SF_BINARY = 0x20
|
||||
local SF_BOOLEAN = 0x24
|
||||
local SF_ASCII = 0x40
|
||||
local SF_JIS_8 = 0x44
|
||||
local SF_INT8 = 0x60
|
||||
local SF_INT1 = 0x64
|
||||
local SF_INT2 = 0x68
|
||||
local SF_INT4 = 0x70
|
||||
local SF_FLOAT8 = 0x80
|
||||
local SF_FLOAT4 = 0x90
|
||||
local SF_UINT8 = 0xA0
|
||||
local SF_UINT1 = 0xA4
|
||||
local SF_UINT2 = 0xA8
|
||||
local SF_UINT4 = 0xB0
|
||||
|
||||
local T1 = 300
|
||||
local T2 = 1000
|
||||
local T3 = 3000
|
||||
|
||||
local MDLN = "DS-80B"
|
||||
local SOFTREV = "MI370E"
|
||||
|
||||
local serial
|
||||
local host = false
|
||||
local connected = false
|
||||
local pending = false
|
||||
local transaction_id = 1
|
||||
|
||||
local function hexDumpString(buf)
|
||||
for i=1,math.ceil(#buf/16) * 16 do
|
||||
if (i-1) % 16 == 0 then io.stderr:write(string.format('%06X ', i-1)) end
|
||||
io.stderr:write( i > #buf and ' ' or string.format('%02X ', buf:byte(i)) )
|
||||
if i % 8 == 0 then io.stderr:write(' ') end
|
||||
if i % 16 == 0 then io.stderr:write( buf:sub(i-16+1, i):gsub('[^%g]','.'), '\n' ) end
|
||||
end
|
||||
io.stderr:write("\n");
|
||||
end
|
||||
|
||||
local function dumpData(items)
|
||||
if items.list then
|
||||
io.stderr:write(string.format("list: %d\n",#items))
|
||||
end
|
||||
for i=1, #items do
|
||||
if not items.list then
|
||||
if i == 1 then
|
||||
io.stderr:write(string.format("type: "..items[1].."\n"));
|
||||
io.stderr:write(string.format("value: "..items[2].."\n"));
|
||||
end
|
||||
else
|
||||
dumpData(items[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function dumpMsg(msg)
|
||||
io.stderr:write("dumpMsg\n-------\n")
|
||||
io.stderr:write(string.format("id: %02X\n", msg.header.secsId))
|
||||
io.stderr:write(string.format("reverse:%s\n", msg.header.secsReverse))
|
||||
io.stderr:write(string.format("stream: %02X\n", msg.header.secsStream))
|
||||
io.stderr:write(string.format("func: %02X\n", msg.header.secsFunction))
|
||||
io.stderr:write(string.format("blkn: %02X\n", msg.header.secsBlock))
|
||||
io.stderr:write(string.format("sys1: %04X\n", msg.header.secsSys1))
|
||||
io.stderr:write(string.format("sys2: %04X\n", msg.header.secsSys2))
|
||||
if #msg > 0 then
|
||||
dumpData(msg[1])
|
||||
end
|
||||
io.stderr:write("\n")
|
||||
end
|
||||
|
||||
local function appendData(values,types,items)
|
||||
|
||||
for i=1, #items do
|
||||
if items.list then
|
||||
appendData(values,types,items[i])
|
||||
else
|
||||
if i == 1 then
|
||||
table.insert(types,items[i])
|
||||
else
|
||||
table.insert(values,items[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function msgData(msg)
|
||||
local values = {}
|
||||
local types = {}
|
||||
|
||||
if #msg > 0 then
|
||||
appendData(values,types,msg[1])
|
||||
end
|
||||
|
||||
return values,types;
|
||||
end
|
||||
|
||||
local function dataSignature(items)
|
||||
local sig = ""
|
||||
|
||||
if items.list then
|
||||
sig = string.format("L%d",#items)
|
||||
end
|
||||
|
||||
for i=1, #items do
|
||||
if items.list then
|
||||
sig = sig..dataSignature(items[i])
|
||||
else
|
||||
if i == 1 then
|
||||
sig = sig..string.format(items[i]);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return sig
|
||||
end
|
||||
|
||||
local function msgSignature(msg)
|
||||
local sig = ""
|
||||
|
||||
if #msg > 0 then
|
||||
sig = dataSignature(msg[1])
|
||||
end
|
||||
|
||||
return sig
|
||||
end
|
||||
|
||||
local function parseData(items,buf,idx,cnt)
|
||||
local len ;
|
||||
local code;
|
||||
|
||||
-- io.stderr:write(string.format("IN: %d\n",idx))
|
||||
while (idx < #buf - 2) and (cnt>0) do
|
||||
len = bit32.band(buf:byte(idx),0x03);
|
||||
code = bit32.band(buf:byte(idx),0xFC);
|
||||
-- io.stderr:write(string.format("CODE: %02X LEN: %02X\n",code,len))
|
||||
len = buf:byte(idx+1);
|
||||
-- io.stderr:write(string.format("DATA LEN: %02X\n",len))
|
||||
cnt = cnt - 1;
|
||||
if code == SF_LIST then
|
||||
local list = {}
|
||||
list.list = true
|
||||
idx = parseData(list,buf,idx+2,len)
|
||||
table.insert(items,list)
|
||||
elseif code == SF_ASCII then
|
||||
table.insert(items,{"A",buf:sub(idx+2,idx+1+len)})
|
||||
idx = idx + len + 2;
|
||||
elseif code == SF_INT1 then
|
||||
table.insert(items,{"I1",struct.unpack(">b",buf:sub(idx+2))})
|
||||
idx = idx + len + 1;
|
||||
elseif code == SF_INT2 then
|
||||
table.insert(items,{"I2",struct.unpack(">h",buf:sub(idx+2))})
|
||||
idx = idx + len + 2;
|
||||
elseif code == SF_INT4 then
|
||||
table.insert(items,{"I4",struct.unpack(">i",buf:sub(idx+2))})
|
||||
idx = idx + len + 4;
|
||||
elseif code == SF_INT8 then
|
||||
table.insert(items,{"I8",struct.unpack(">l",buf:sub(idx+2))})
|
||||
idx = idx + len + 8;
|
||||
elseif code == SF_UINT1 then
|
||||
table.insert(items,{"U1",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + 1;
|
||||
elseif code == SF_UINT2 then
|
||||
table.insert(items,{"U2",struct.unpack(">H",buf:sub(idx+2))})
|
||||
idx = idx + len + 2;
|
||||
elseif code == SF_INT4 then
|
||||
table.insert(items,{"U4",struct.unpack(">I",buf:sub(idx+2))})
|
||||
idx = idx + len + 4;
|
||||
elseif code == SF_UINT8 then
|
||||
table.insert(items,{"U8",struct.unpack(">L",buf:sub(idx+2))})
|
||||
idx = idx + len + 8;
|
||||
elseif code == SF_BOOLEAN then
|
||||
table.insert(items,{"BOOL",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + 1;
|
||||
elseif code == SF_BINARY then
|
||||
table.insert(items,{"B",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + 1;
|
||||
-- elseif TODO more formats
|
||||
end
|
||||
end
|
||||
-- io.stderr:write(string.format("OUT: %d\n",idx))
|
||||
return idx;
|
||||
end
|
||||
|
||||
local function unpackHeader(b)
|
||||
local h = {}
|
||||
|
||||
h.secsId, h.secsStream, h.secsFunction, h.secsBlock, h.secsSys1, h.secsSys2 = struct.unpack('>HBBHHH',b)
|
||||
h.secsReverse = h.secsId > 0x8000;
|
||||
h.secsId = bit32.band(h.secsId,0x7FFF);
|
||||
h.secsWait = h.secsStream > 0x80;
|
||||
h.secsStream = bit32.band(h.secsStream,0x7F);
|
||||
h.secsEnd = h.secsBlock > 0x8000;
|
||||
h.secsBlock = bit32.band(h.secsBlock,0x7FFF);
|
||||
|
||||
return h;
|
||||
end
|
||||
|
||||
local function parseMsg(buf)
|
||||
local msg = {};
|
||||
local len = 0;
|
||||
local code = 0;
|
||||
|
||||
msg.header = unpackHeader(buf);
|
||||
msg.list = false;
|
||||
|
||||
parseData(msg,buf,11,100);
|
||||
|
||||
return msg;
|
||||
end
|
||||
|
||||
local function packHeader(h)
|
||||
return struct.pack('>HBBHHH',
|
||||
( h.secsReverse and bit32.bor(h.secsId, 0x8000) or h.secsId ),
|
||||
( h.secsWait and bit32.bor(h.secsStream, 0x80) or h.secsStream ),
|
||||
h.secsFunction,
|
||||
( h.secsEnd and bit32.bor(h.secsBlock, 0x8000) or h.secsBlock),
|
||||
h.secsSys1,
|
||||
h.secsSys2
|
||||
)
|
||||
end
|
||||
|
||||
local function packString(s)
|
||||
return struct.pack('BB',SF_ASCII+1,#s)..s
|
||||
end
|
||||
|
||||
local function packBinary(b)
|
||||
return struct.pack('BBB',SF_BINARY+1,1,b)
|
||||
end
|
||||
|
||||
local function packList(l)
|
||||
-- io.stderr:write("packList type("..type(l)..")\n")
|
||||
return struct.pack('BB',SF_LIST+1,#l)..table.concat(l)
|
||||
end
|
||||
|
||||
local function secondaryHeader(h,s,f)
|
||||
h.secaId = 0; --
|
||||
h.secsReverse = not host -- false: host --> equipment
|
||||
|
||||
h.secsStream = s;
|
||||
h.secsFunction = f; -- secondary Message SsFf
|
||||
h.secsWait = false; -- no reply
|
||||
|
||||
h.secsBlock = 1;
|
||||
h.secsEnd = true; -- last block
|
||||
return packHeader(h);
|
||||
end
|
||||
|
||||
local function primaryHeader(s,f)
|
||||
pending = true
|
||||
transactionTimer.restart()
|
||||
|
||||
local h = {}
|
||||
|
||||
h.secsId = 0; --
|
||||
h.secsReverse = not host -- false: host --> equipment
|
||||
|
||||
h.secsStream = s;
|
||||
h.secsFunction = f; -- primary Message SsFf
|
||||
h.secsWait = true; -- reply
|
||||
|
||||
h.secsBlock = 1;
|
||||
h.secsEnd = true; -- last block
|
||||
h.secsSys1 = 0
|
||||
h.secsSys2 = transaction_id;
|
||||
|
||||
transaction_id = transaction_id + 1
|
||||
|
||||
return packHeader(h);
|
||||
end
|
||||
|
||||
local function SxF0(h)
|
||||
io.stderr:write("SxF0\n----\n")
|
||||
|
||||
return {
|
||||
secondaryHeader(h,h.s_stream,0)
|
||||
}
|
||||
end
|
||||
|
||||
local function S1F1()
|
||||
io.stderr:write("S1F1\n----\n")
|
||||
|
||||
return {
|
||||
primaryHeader(1,1)
|
||||
}
|
||||
end
|
||||
|
||||
local function S1F2(h)
|
||||
io.stderr:write("S1F2\n----\n")
|
||||
|
||||
if host then
|
||||
return {
|
||||
secondaryHeader(h,1,2),
|
||||
packList( {} )
|
||||
}
|
||||
else
|
||||
return {
|
||||
secondaryHeader(h,1,2),
|
||||
packList( {
|
||||
packString(MDLN),
|
||||
packString(SOFTREV)
|
||||
} )
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local function S1F13()
|
||||
io.stderr:write("S1F13\n----\n")
|
||||
|
||||
if host then
|
||||
return {
|
||||
primaryHeader(1,13),
|
||||
packList( {
|
||||
packBinary(0),
|
||||
packList( {} )
|
||||
} )
|
||||
}
|
||||
else
|
||||
return {
|
||||
primaryHeader(1,13),
|
||||
packList( {
|
||||
packBinary(0),
|
||||
packList( {
|
||||
packString(MDLN),
|
||||
packString(SOFTREV)
|
||||
} )
|
||||
} )
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local function S1F14(h)
|
||||
io.stderr:write("S1F14\n----\n")
|
||||
|
||||
if host then
|
||||
return {
|
||||
secondaryHeader(h,1,14),
|
||||
packList( {
|
||||
packBinary(0),
|
||||
packList( {} )
|
||||
} )
|
||||
}
|
||||
else
|
||||
return {
|
||||
secondaryHeader(h,1,14),
|
||||
packList( {
|
||||
packBinary(0),
|
||||
packList( {
|
||||
packString(MDLN),
|
||||
packString(SOFTREV)
|
||||
} )
|
||||
} )
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local function S2F41(ppid,mid1,mid2,mid3)
|
||||
io.stderr:write("S2F41("..ppid..","..mid1..","..mid2..","..mid3..")\n----\n")
|
||||
|
||||
if host then
|
||||
return {
|
||||
primaryHeader(2,41),
|
||||
packList( {
|
||||
packString("START"),
|
||||
packList( {
|
||||
packList( {
|
||||
packString("PPID"),
|
||||
packString(ppid)
|
||||
} ),
|
||||
packList( {
|
||||
packString("MID1"),
|
||||
packString(mid1)
|
||||
} ),
|
||||
packList( {
|
||||
packString("MID2"),
|
||||
packString(mid2)
|
||||
} ),
|
||||
packList( {
|
||||
packString("MID3"),
|
||||
packString(mid3)
|
||||
} )
|
||||
} )
|
||||
} )
|
||||
}
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
local function S2F42(h)
|
||||
io.stderr:write("S2F42\n----\n")
|
||||
|
||||
return {
|
||||
secondaryHeader(h,2,42),
|
||||
packList( {
|
||||
packBinary(4),
|
||||
packList({}) -- empty list
|
||||
} )
|
||||
}
|
||||
end
|
||||
|
||||
local function S6F12(h)
|
||||
io.stderr:write("S6F12\n----\n")
|
||||
|
||||
if host then
|
||||
|
||||
return {
|
||||
secondaryHeader(h,6,12),
|
||||
packBinary(0)
|
||||
}
|
||||
else
|
||||
secondaryHeader(h,h.secsStream,0)
|
||||
end
|
||||
end
|
||||
|
||||
local function isSF(msg,s,f)
|
||||
return msg.header.secsStream == s and msg.header.secsFunction == f
|
||||
end
|
||||
|
||||
function isSxF0(msg)
|
||||
return msg.header.secsFunction == 0
|
||||
end
|
||||
|
||||
local function sendMsg(msg)
|
||||
|
||||
local buf = table.concat(msg);
|
||||
|
||||
-- hexDumpString(buf)
|
||||
|
||||
serial:write(ASCII_ENQ)
|
||||
|
||||
if serial:poll(T1) then
|
||||
c = serial:read(1)
|
||||
|
||||
if c == ASCII_EOT then
|
||||
serial:write(string.char(#buf))
|
||||
|
||||
local chksum = 0
|
||||
|
||||
for i=1, #buf do
|
||||
serial:write(string.char(buf:byte(i)))
|
||||
chksum = chksum + buf:byte(i);
|
||||
-- io.stderr:write(string.format('%02X ',buf:byte(i)));
|
||||
end
|
||||
|
||||
serial:write(string.char(chksum / 256))
|
||||
serial:write(string.char(chksum % 256))
|
||||
|
||||
if serial:poll(T1) then
|
||||
c = serial:read(1)
|
||||
if not (c == ASCII_ACK) then
|
||||
io.stderr:write("SECS I: NAK Received\n")
|
||||
end
|
||||
else
|
||||
io.stderr:write("SECS I: AKN Timeout\n")
|
||||
end
|
||||
end
|
||||
else
|
||||
io.stderr:write("SECS I: EOT Timeout\n")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function receiveMsg()
|
||||
serial:write(ASCII_EOT)
|
||||
|
||||
if serial:poll(T1) then
|
||||
local cnt = string.byte(serial:read(1))
|
||||
io.stderr:write("receiveMsg\n----------\ncount: "..cnt.."\n")
|
||||
|
||||
local buf = serial:read(cnt+2,10*T1)
|
||||
|
||||
-- TODO checksum error handling
|
||||
|
||||
-- hexDumpString(buf);
|
||||
|
||||
serial:write(ASCII_ACK)
|
||||
|
||||
msg = parseMsg(buf)
|
||||
-- dumpMsg(msg)
|
||||
|
||||
return msg
|
||||
else
|
||||
io.stderr:write("SECS I: Countbyte Timeout\n")
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
local function poll()
|
||||
|
||||
local request = {}
|
||||
|
||||
if ( serial:poll(T1) ) then
|
||||
c = serial:read(1)
|
||||
-- io.stderr:write(string.format("C: %02X\n",c:byte()));
|
||||
if c == ASCII_ENQ then
|
||||
|
||||
request = receiveMsg()
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
if not request.header.wait then
|
||||
pending = false;
|
||||
end
|
||||
|
||||
msgSignature(request)
|
||||
|
||||
if isSF(request,1,1) then
|
||||
sendMsg(S1F2(request.header))
|
||||
SECS.onPrimary(1,1,"are you there")
|
||||
elseif isSF(request,1,2) then
|
||||
SECS.onSecondary(1,2,"are you there akn")
|
||||
elseif isSF(request,1,13) then
|
||||
sendMsg(S1F14(request.header))
|
||||
connected = true;
|
||||
SECS.onPrimary(1,13,"establish communication request")
|
||||
--io.stderr:write(string.format("CONNECTED %d\n",request[1][1][2]));
|
||||
elseif isSF(request,1,14) then
|
||||
connected = true;
|
||||
SECS.onSecondary(1,14,"establish communication request akn")
|
||||
--io.stderr:write(string.format("CONNECTED %d\n",request[1][1][2]));
|
||||
elseif isSF(request,2,41) then
|
||||
SECS.onProcessMsg(msg)
|
||||
sendMsg(S2F42(request.header))
|
||||
SECS.onPrimary(2,41,"host command send")
|
||||
elseif isSF(request,2,42) then
|
||||
SECS.onSecondary(2,42,"host command send akn")
|
||||
elseif isSF(request,6,11) then
|
||||
SECS.onProcessMsg(msg)
|
||||
sendMsg(S6F12(request.header))
|
||||
SECS.onPrimary(6,11,"event report send")
|
||||
elseif isSF(request,6,12) then
|
||||
--
|
||||
SECS.onSecondary(6,12,"event report send akn")
|
||||
else
|
||||
if not isSxF0(request) then
|
||||
sendMsg(SxF0(request.header))
|
||||
SECS.onPrimary(0,0,"abort transaction akn")
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
---- TODO: Illegal byte, skip input send NAK ----
|
||||
io.stderr:write("loop poll:"..string.byte(c).."\n")
|
||||
end
|
||||
else
|
||||
if pending and transactionTimer.elapsed() then
|
||||
---- TODO: Timeout, skip input send NAK ----
|
||||
io.stderr:write("loop poll: Transaction timeout\n")
|
||||
pending = false;
|
||||
end
|
||||
end
|
||||
|
||||
io.stderr:flush();
|
||||
|
||||
end
|
||||
|
||||
local function setHost(mode)
|
||||
host = mode
|
||||
end
|
||||
|
||||
local function begin(device, baud)
|
||||
serial = Serial(device,baud)
|
||||
transactionTimer = Scheduler.Timer(T3)
|
||||
end
|
||||
|
||||
return {
|
||||
begin = begin;
|
||||
sendMsg = sendMsg;
|
||||
dumpMsg = dumpMsg;
|
||||
msgSignature= msgSignature;
|
||||
msgData = msgData;
|
||||
|
||||
setHost = setHost;
|
||||
isHost = function() return host end;
|
||||
|
||||
isConnected = function() return connected end;
|
||||
isPending = function() return pending end;
|
||||
|
||||
poll = poll;
|
||||
|
||||
sendS1F13 = function() sendMsg(S1F13()) end;
|
||||
sendS1F1 = function() sendMsg(S1F1()) end;
|
||||
sendS2F41 = function(a1,a2,a3,a4) sendMsg(S2F41(a1,a2,a3,a4)) end;
|
||||
}
|
||||
184
2B+Software/app/secs_i.lua
Normal file
184
2B+Software/app/secs_i.lua
Normal file
@@ -0,0 +1,184 @@
|
||||
periphery = require('periphery')
|
||||
|
||||
Serial = periphery.Serial
|
||||
|
||||
Scheduler = require('scheduler')
|
||||
|
||||
local T1 = 100 --300
|
||||
local T2 = 2000 --1000
|
||||
local T3 = 5000 --3000
|
||||
|
||||
local ASCII_EOT = "\x04" -- end of transmission
|
||||
local ASCII_ENQ = "\x05" -- enquiary
|
||||
local ASCII_ACK = "\x06" -- acknowledge
|
||||
local ASCII_NAK = "\x15" -- negative acknowledge
|
||||
|
||||
local pending = false
|
||||
local reading = false
|
||||
local writing = false
|
||||
|
||||
local serial
|
||||
|
||||
local onProcessRequest;
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
local function hexDumpString(buf)
|
||||
if buf then
|
||||
for i=1,math.ceil(#buf/16) * 16 do
|
||||
if (i-1) % 16 == 0 then io.stderr:write(string.format('%06X ', i-1)) end
|
||||
io.stderr:write( i > #buf and ' ' or string.format('%02X ', buf:byte(i)) )
|
||||
if i % 8 == 0 then io.stderr:write(' ') end
|
||||
if i % 16 == 0 then io.stderr:write( buf:sub(i-16+1, i):gsub('[^%g]','.'), '\n' ) end
|
||||
end
|
||||
io.stderr:write("\n");
|
||||
end
|
||||
end
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
function begin(device, baud)
|
||||
serial = Serial(device,baud)
|
||||
transactionTimer = Scheduler.Timer(T3)
|
||||
end
|
||||
|
||||
local function discardInput()
|
||||
hexDumpString(buf);
|
||||
io.stderr:write("SECS I:\t Discard input: ")
|
||||
while serial:poll(100) do
|
||||
c = serial:read(1)
|
||||
io.stderr:write(string.format('%02X ',c:byte(1)));
|
||||
end
|
||||
io.stderr:write("\n")
|
||||
end
|
||||
|
||||
local function sendMsg(buf)
|
||||
|
||||
-- hexDumpString(buf)
|
||||
|
||||
writing = true
|
||||
serial:write(ASCII_ENQ)
|
||||
|
||||
if serial:poll(T1) then
|
||||
c = serial:read(1)
|
||||
|
||||
if c == ASCII_EOT then
|
||||
serial:write(string.char(#buf))
|
||||
|
||||
local chksum = 0 -- 0 normal, 1 force error
|
||||
|
||||
for i=1, #buf do
|
||||
serial:write(string.char(buf:byte(i)))
|
||||
chksum = chksum + buf:byte(i);
|
||||
-- io.stderr:write(string.format('%02X ',buf:byte(i)));
|
||||
end
|
||||
|
||||
serial:write(string.char(math.floor(chksum / 256)))
|
||||
serial:write(string.char(chksum % 256))
|
||||
|
||||
if serial:poll(T1) then
|
||||
c = serial:read(1)
|
||||
if not (c == ASCII_ACK) then
|
||||
io.stderr:write("SECS I:\t NAK Received\n")
|
||||
--discardInput()
|
||||
end
|
||||
else
|
||||
io.stderr:write("SECS I:\t AKN Timeout\n")
|
||||
discardInput()
|
||||
end
|
||||
writing = false
|
||||
end
|
||||
else
|
||||
io.stderr:write("SECS I:\t EOT Timeout\n")
|
||||
discardInput()
|
||||
writing = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function receiveMsg()
|
||||
serial:write(ASCII_EOT)
|
||||
|
||||
reading = true
|
||||
if serial:poll(T1) then
|
||||
local cnt = string.byte(serial:read(1))
|
||||
io.stderr:write("SECS I:\t receiveMsg count: "..cnt.."\n")
|
||||
|
||||
local buf = serial:read(cnt+2,10*T1)
|
||||
|
||||
local chksum = 0 -- 0 normal, 1 force error
|
||||
for i=1, #buf-2 do
|
||||
chksum = chksum + buf:byte(i)
|
||||
end
|
||||
|
||||
local msgChksum = buf:byte(#buf-1)*256 + buf:byte(#buf)
|
||||
|
||||
if msgChksum == chksum then
|
||||
serial:write(ASCII_ACK)
|
||||
return buf
|
||||
else
|
||||
io.stderr:write("SECS I:\t Checksum Error\n")
|
||||
hexDumpString(buf)
|
||||
serial:write(ASCII_NAK)
|
||||
discardInput()
|
||||
--io.stderr:write(string.format("SECS I:\t Checksum: %04X %04X\n",chksum,msgChksum))
|
||||
io.stderr:write(string.format("SECS I:\t Bytes: %d Checksum: %04X %04X\n",#buf,chksum,msgChksum))
|
||||
return ""
|
||||
end
|
||||
reading = false
|
||||
else
|
||||
io.stderr:write("SECS I:\t Countbyte Timeout\n")
|
||||
discardInput()
|
||||
reading = false
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local function poll()
|
||||
|
||||
if ( serial:poll(T1) ) then
|
||||
c = serial:read(1)
|
||||
-- io.stderr:write(string.format("C: %02X\n",c:byte()));
|
||||
if c == ASCII_ENQ then
|
||||
local buf=receiveMsg()
|
||||
if #buf >= 11 then
|
||||
onProcessRequest(buf)
|
||||
else
|
||||
io.stderr:write("SECS I:\t Poll error bytes: "..#buf.."\n")
|
||||
discardInput(buf)
|
||||
serial:write(ASCII_NAK)
|
||||
end
|
||||
elseif c == ASCII_NAK then
|
||||
io.stderr:write("SECS I:\t Poll NAK received\n")
|
||||
--discardInput()
|
||||
pending = false
|
||||
else
|
||||
---- TODO: Illegal byte, skip input send NAK ----
|
||||
io.stderr:write(string.format("SECS I:\t Poll error byte = %02X\n",string.byte(c)))
|
||||
discardInput()
|
||||
serial:write(ASCII_NAK)
|
||||
pending = false
|
||||
end
|
||||
else
|
||||
if pending and transactionTimer.elapsed() then
|
||||
---- TODO: Timeout, skip input send NAK ----
|
||||
io.stderr:write("SECS I:\t Poll transaction timeout\n")
|
||||
discardInput(buf)
|
||||
serial:write(ASCII_NAK)
|
||||
pending = false;
|
||||
end
|
||||
end
|
||||
|
||||
io.stderr:flush();
|
||||
end
|
||||
|
||||
return {
|
||||
begin = begin;
|
||||
poll = poll;
|
||||
sendMsg = sendMsg;
|
||||
receiveMsg = receiveMsg;
|
||||
isReading = function() return reading end;
|
||||
isWriting = function() return writing end;
|
||||
isPending = function() return pending end;
|
||||
onProcessRequest = function(cb) onProcessRequest = cb end;
|
||||
startTransaction = function() transactionTimer.restart(); pending = true end;
|
||||
stopTransaction = function() pending = false end;
|
||||
}
|
||||
633
2B+Software/app/secs_ii.lua
Normal file
633
2B+Software/app/secs_ii.lua
Normal file
@@ -0,0 +1,633 @@
|
||||
---------------------------- SECS I / SECS II ----------------------------------
|
||||
|
||||
SECS_IO = require('secs_i')
|
||||
struct = require('struct')
|
||||
|
||||
local SF_LIST = 0x00
|
||||
local SF_NITEMS = 0x1F
|
||||
local SF_BINARY = 0x20
|
||||
local SF_BOOLEAN = 0x24
|
||||
local SF_ASCII = 0x40
|
||||
local SF_JIS_8 = 0x44
|
||||
local SF_INT8 = 0x60
|
||||
local SF_INT1 = 0x64
|
||||
local SF_INT2 = 0x68
|
||||
local SF_INT4 = 0x70
|
||||
local SF_FLOAT8 = 0x80
|
||||
local SF_FLOAT4 = 0x90
|
||||
local SF_UINT8 = 0xA0
|
||||
local SF_UINT1 = 0xA4
|
||||
local SF_UINT2 = 0xA8
|
||||
local SF_UINT4 = 0xB0
|
||||
|
||||
local MDLN = "DS-80B"
|
||||
local SOFTREV = "MI370E"
|
||||
|
||||
local secsId = 0x1234
|
||||
local host = false
|
||||
local connected = false
|
||||
|
||||
local transaction_id = 1
|
||||
|
||||
local eq_online = 3 -- 1: online remote, 2: online local, 3: offline
|
||||
local eq_status = 2 -- 1: not ready, 2: ready, 3: busy, 4: process cmpl, 5: pause, 6: complete
|
||||
|
||||
local onSendEventMsg = nil
|
||||
local onPrimaryMsg = nil
|
||||
local onSecondaryMsg = nil
|
||||
local onProcessMsg = nil
|
||||
|
||||
local msgQueue = {}
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
local function hexDumpString(buf)
|
||||
for i=1,math.ceil(#buf/16) * 16 do
|
||||
if (i-1) % 16 == 0 then io.stderr:write(string.format('%06X ', i-1)) end
|
||||
io.stderr:write( i > #buf and ' ' or string.format('%02X ', buf:byte(i)) )
|
||||
if i % 8 == 0 then io.stderr:write(' ') end
|
||||
if i % 16 == 0 then io.stderr:write( buf:sub(i-16+1, i):gsub('[^%g]','.'), '\n' ) end
|
||||
end
|
||||
io.stderr:write("\n");
|
||||
end
|
||||
|
||||
local function dumpData(items)
|
||||
if items.list then
|
||||
io.stderr:write(string.format("list: %d\n",#items))
|
||||
end
|
||||
for i=1, #items do
|
||||
if not items.list then
|
||||
if i == 1 then
|
||||
io.stderr:write(string.format("type: "..items[1].."\n"));
|
||||
io.stderr:write(string.format("value: "..items[2].."\n"));
|
||||
end
|
||||
else
|
||||
dumpData(items[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function dumpMsg(msg)
|
||||
io.stderr:write("dumpMsg\n-------\n")
|
||||
io.stderr:write(string.format("id: %02X\n", msg.header.secsId))
|
||||
io.stderr:write(string.format("reverse:%s\n", msg.header.secsReverse))
|
||||
io.stderr:write(string.format("stream: %02X\n", msg.header.secsStream))
|
||||
io.stderr:write(string.format("func: %02X\n", msg.header.secsFunction))
|
||||
io.stderr:write(string.format("blkn: %02X\n", msg.header.secsBlock))
|
||||
io.stderr:write(string.format("sys1: %04X\n", msg.header.secsSys1))
|
||||
io.stderr:write(string.format("sys2: %04X\n", msg.header.secsSys2))
|
||||
if #msg > 0 then
|
||||
dumpData(msg[1])
|
||||
end
|
||||
io.stderr:write("\n")
|
||||
end
|
||||
|
||||
local function appendData(values,types,items)
|
||||
|
||||
for i=1, #items do
|
||||
if items.list then
|
||||
appendData(values,types,items[i])
|
||||
else
|
||||
if i == 1 then
|
||||
table.insert(types,items[i])
|
||||
else
|
||||
table.insert(values,items[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function msgData(msg)
|
||||
local values = {}
|
||||
local types = {}
|
||||
|
||||
if #msg > 0 then
|
||||
appendData(values,types,msg[1])
|
||||
end
|
||||
|
||||
return values,types;
|
||||
end
|
||||
|
||||
local function dataSignature(items)
|
||||
local sig = ""
|
||||
|
||||
if items.list then
|
||||
sig = string.format("L%d",#items)
|
||||
end
|
||||
|
||||
for i=1, #items do
|
||||
if items.list then
|
||||
sig = sig..dataSignature(items[i])
|
||||
else
|
||||
if i == 1 then
|
||||
sig = sig..string.format(items[i]);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return sig
|
||||
end
|
||||
|
||||
local function msgSignature(msg)
|
||||
local sig = ""
|
||||
|
||||
if #msg > 0 then
|
||||
sig = dataSignature(msg[1])
|
||||
end
|
||||
|
||||
return sig
|
||||
end
|
||||
--[[
|
||||
local function parseData(items,buf,idx,cnt)
|
||||
local len ;
|
||||
local code;
|
||||
|
||||
-- io.stderr:write(string.format("IN: %d\n",idx))
|
||||
while (idx < #buf - 2) and (cnt>0) do
|
||||
len = bit32.band(buf:byte(idx),0x03);
|
||||
code = bit32.band(buf:byte(idx),0xFC);
|
||||
-- io.stderr:write(string.format("CODE: %02X LEN: %02X\n",code,len))
|
||||
len = buf:byte(idx+1);
|
||||
-- io.stderr:write(string.format("DATA LEN: %02X\n",len))
|
||||
cnt = cnt - 1;
|
||||
if code == SF_LIST then
|
||||
local list = {}
|
||||
list.list = true
|
||||
idx = parseData(list,buf,idx+2,len)
|
||||
table.insert(items,list)
|
||||
elseif code == SF_ASCII then
|
||||
table.insert(items,{"A",buf:sub(idx+2,idx+1+len)})
|
||||
idx = idx + len + 2;
|
||||
elseif code == SF_INT1 then
|
||||
table.insert(items,{"I1",struct.unpack(">b",buf:sub(idx+2))})
|
||||
idx = idx + len + 1;
|
||||
elseif code == SF_INT2 then
|
||||
table.insert(items,{"I2",struct.unpack(">h",buf:sub(idx+2))})
|
||||
idx = idx + len + 2;
|
||||
elseif code == SF_INT4 then
|
||||
table.insert(items,{"I4",struct.unpack(">i",buf:sub(idx+2))})
|
||||
idx = idx + len + 4;
|
||||
elseif code == SF_INT8 then
|
||||
table.insert(items,{"I8",struct.unpack(">l",buf:sub(idx+2))})
|
||||
idx = idx + len + 8;
|
||||
elseif code == SF_UINT1 then
|
||||
table.insert(items,{"U1",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + 1;
|
||||
elseif code == SF_UINT2 then
|
||||
table.insert(items,{"U2",struct.unpack(">H",buf:sub(idx+2))})
|
||||
idx = idx + len + 2;
|
||||
elseif code == SF_INT4 then
|
||||
table.insert(items,{"U4",struct.unpack(">I",buf:sub(idx+2))})
|
||||
idx = idx + len + 4;
|
||||
elseif code == SF_UINT8 then
|
||||
table.insert(items,{"U8",struct.unpack(">L",buf:sub(idx+2))})
|
||||
idx = idx + len + 8;
|
||||
elseif code == SF_BOOLEAN then
|
||||
table.insert(items,{"BOOL",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + 1;
|
||||
elseif code == SF_BINARY then
|
||||
table.insert(items,{"B",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + 1;
|
||||
-- elseif TODO more formats
|
||||
end
|
||||
end
|
||||
-- io.stderr:write(string.format("OUT: %d\n",idx))
|
||||
return idx;
|
||||
end
|
||||
--]]
|
||||
|
||||
local function parseData(items,buf,idx,cnt)
|
||||
local len ;
|
||||
local code;
|
||||
|
||||
io.stderr:write(string.format("IN: %d\n",idx))
|
||||
while (idx < #buf - 2) and (cnt>0) do
|
||||
io.stderr:write(string.format("IDX: %d\n",idx))
|
||||
num = bit32.band(buf:byte(idx),0x03);
|
||||
code = bit32.band(buf:byte(idx),0xFC);
|
||||
io.stderr:write(string.format("CODE: %02X LEN: %02X\n",code,num))
|
||||
len = buf:byte(idx+1);
|
||||
io.stderr:write(string.format("DATA LEN: %02X %03d\n",len,len))
|
||||
cnt = cnt - 1;
|
||||
if code == SF_LIST then
|
||||
local list = {}
|
||||
list.list = true
|
||||
idx = parseData(list,buf,idx+2,len)
|
||||
table.insert(items,list)
|
||||
elseif code == SF_ASCII then
|
||||
table.insert(items,{"A",buf:sub(idx+2,idx+1+len)})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_INT1 then
|
||||
table.insert(items,{"I1",struct.unpack(">b",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_INT2 then
|
||||
table.insert(items,{"I2",struct.unpack(">h",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_INT4 then
|
||||
table.insert(items,{"I4",struct.unpack(">i",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_INT8 then
|
||||
table.insert(items,{"I8",struct.unpack(">l",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_UINT1 then
|
||||
table.insert(items,{"U1",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_UINT2 then
|
||||
table.insert(items,{"U2",struct.unpack(">H",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_INT4 then
|
||||
table.insert(items,{"U4",struct.unpack(">I",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_UINT8 then
|
||||
table.insert(items,{"U8",struct.unpack(">L",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_BOOLEAN then
|
||||
table.insert(items,{"BOOL",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
elseif code == SF_BINARY then
|
||||
table.insert(items,{"B",struct.unpack(">B",buf:sub(idx+2))})
|
||||
idx = idx + len + num + 1;
|
||||
-- elseif TODO more formats
|
||||
end
|
||||
end
|
||||
io.stderr:write(string.format("OUT: %d\n",idx))
|
||||
return idx;
|
||||
end
|
||||
|
||||
local function unpackHeader(b)
|
||||
local h = {}
|
||||
h.secsId, h.secsStream, h.secsFunction, h.secsBlock, h.secsSys1, h.secsSys2 = struct.unpack('>HBBHHH',b)
|
||||
h.secsReverse = h.secsId > 0x8000;
|
||||
h.secsId = bit32.band(h.secsId,0x7FFF);
|
||||
h.secsWait = h.secsStream > 0x80;
|
||||
h.secsStream = bit32.band(h.secsStream,0x7F);
|
||||
h.secsEnd = h.secsBlock > 0x8000;
|
||||
h.secsBlock = bit32.band(h.secsBlock,0x7FFF);
|
||||
|
||||
return h;
|
||||
end
|
||||
|
||||
local function parseMsg(buf)
|
||||
local msg = {};
|
||||
local len = 0;
|
||||
local code = 0;
|
||||
|
||||
msg.header = unpackHeader(buf);
|
||||
msg.list = false;
|
||||
parseData(msg,buf,11,#buf);
|
||||
return msg;
|
||||
end
|
||||
|
||||
local function packHeader(h)
|
||||
return struct.pack('>HBBHHH',
|
||||
( h.secsReverse and bit32.bor(h.secsId, 0x8000) or h.secsId ),
|
||||
( h.secsWait and bit32.bor(h.secsStream, 0x80) or h.secsStream ),
|
||||
h.secsFunction,
|
||||
( h.secsEnd and bit32.bor(h.secsBlock, 0x8000) or h.secsBlock),
|
||||
h.secsSys1,
|
||||
h.secsSys2
|
||||
)
|
||||
end
|
||||
|
||||
local function packString(s)
|
||||
return struct.pack('BB',SF_ASCII+1,#s)..s
|
||||
end
|
||||
|
||||
local function packBinary(b)
|
||||
return struct.pack('BBB',SF_BINARY+1,1,b)
|
||||
end
|
||||
|
||||
local function packList(l)
|
||||
return struct.pack('BB',SF_LIST+1,#l)..table.concat(l)
|
||||
end
|
||||
|
||||
local function secondaryHeader(h,s,f)
|
||||
h.secsId = secsId; --
|
||||
h.secsReverse = not host -- false: host --> equipment
|
||||
|
||||
h.secsStream = s;
|
||||
h.secsFunction = f; -- secondary Message SsFf
|
||||
h.secsWait = false; -- no reply
|
||||
|
||||
h.secsBlock = 1;
|
||||
h.secsEnd = true; -- last block
|
||||
return packHeader(h);
|
||||
end
|
||||
|
||||
local function primaryHeader(s,f)
|
||||
-- SECS_IO.startTransaction()
|
||||
|
||||
local h = {}
|
||||
|
||||
h.secsId = secsId; --
|
||||
h.secsReverse = not host -- false: host --> equipment
|
||||
|
||||
h.secsStream = s;
|
||||
h.secsFunction = f; -- primary Message SsFf
|
||||
h.secsWait = true; -- reply
|
||||
|
||||
h.secsBlock = 1;
|
||||
h.secsEnd = true; -- last block
|
||||
h.secsSys1 = 0
|
||||
h.secsSys2 = transaction_id;
|
||||
|
||||
transaction_id = transaction_id + 1
|
||||
|
||||
return packHeader(h);
|
||||
end
|
||||
|
||||
function string.pop(s)
|
||||
return string.sub(s,1,1),string.sub(s,2)
|
||||
end
|
||||
|
||||
function table.pop(t)
|
||||
local i = t[1]
|
||||
table.remove(t,1)
|
||||
return i,t
|
||||
end
|
||||
|
||||
local function packData(sig,items)
|
||||
local buf = ""
|
||||
|
||||
-- print("packData sig: ",sig)
|
||||
while #sig > 0 do
|
||||
-- print("packData len1: ",#sig)
|
||||
typ, sig = string.pop(sig)
|
||||
-- print("packData len2: ",#sig,typ,sig)
|
||||
if typ == "L" then
|
||||
len , sig = string.pop(sig)
|
||||
-- print("packData len3: ",#sig,len,sig)
|
||||
buf = buf..struct.pack('BB',SF_LIST+1,len)..packData(sig,items)
|
||||
-- hexDumpString(buf)
|
||||
return buf
|
||||
elseif typ == "A" then
|
||||
item, items = table.pop(items)
|
||||
buf = buf..packString(item)
|
||||
elseif typ == "B" then
|
||||
item, items = table.pop(items)
|
||||
buf = buf..packBinary(item)
|
||||
end
|
||||
end
|
||||
-- hexDumpString(buf)
|
||||
return buf
|
||||
end
|
||||
|
||||
local function primaryMsg(s,f,sig,items)
|
||||
return primaryHeader(s,f)..packData(sig,items)
|
||||
end
|
||||
|
||||
local function secondaryMsg(h,s,f,sig,items)
|
||||
return secondaryHeader(h,s,f)..packData(sig,items)
|
||||
end
|
||||
|
||||
-------------------------------------------------------
|
||||
|
||||
local function SxF0(h)
|
||||
io.stderr:write("\nSECS II: SxF0\n----\n")
|
||||
return secondaryHeader(h,h.secsStream,0)
|
||||
end
|
||||
|
||||
local function S1F1()
|
||||
io.stderr:write("\nSECS II: S1F1\n----\n")
|
||||
return primaryHeader(1,1)
|
||||
end
|
||||
|
||||
local function S1F2(h)
|
||||
io.stderr:write("\nSECS II: S1F2\n----\n")
|
||||
|
||||
if host then
|
||||
return secondaryMsg(h,1,2,"L0",{})
|
||||
else
|
||||
return secondaryMsg(h,1,2,"L2AA",{MDLN,SOFTREV})
|
||||
end
|
||||
end
|
||||
|
||||
local function S1F13()
|
||||
io.stderr:write("\nSECS II: S1F13\n----\n")
|
||||
|
||||
if host then
|
||||
return primaryMsg(1,13,"L2BL0",{0})
|
||||
else
|
||||
return primaryMsg(1,13,"L2BL2AA",{0,MDLN,SOFTREV})
|
||||
end
|
||||
end
|
||||
|
||||
local function S1F14(h)
|
||||
io.stderr:write("\nSECS II: S1F14\n----\n")
|
||||
|
||||
if host then
|
||||
return secondaryMsg(h,1,14,"L2BL0",{0})
|
||||
else
|
||||
return secondaryMsg(h,1,14,"L2BL2AA",{0,MDLN,SOFTREV})
|
||||
end
|
||||
end
|
||||
|
||||
local function S2F41(c)
|
||||
|
||||
io.stderr:write("\nSECS II: S2F41("..c..")\n----\n")
|
||||
if host then
|
||||
return onCreateMsg(2,41,c)
|
||||
else
|
||||
return "" -- host only command
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function S2F42(h)
|
||||
io.stderr:write("\nSECS II: S2F42\n----\n")
|
||||
|
||||
return secondaryMsg(h,2,42,"L2BL0",{4})
|
||||
end
|
||||
|
||||
local function S5F2(h)
|
||||
io.stderr:write("\nSECS II: S5F2\n----\n")
|
||||
|
||||
if host then
|
||||
return secondaryMsg(h,5,2,"B",{0})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function S6F12(h)
|
||||
io.stderr:write("\nSECS II: S6F12\n----\n")
|
||||
|
||||
if host then
|
||||
return secondaryMsg(h,6,12,"B",{0})
|
||||
else
|
||||
return secondaryHeader(h,h.secsStream,0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function S6F11(e)
|
||||
io.stderr:write("\nSECS II: S6F11("..e..")\n----\n")
|
||||
|
||||
if not host then
|
||||
return onCreateMsg(6,11,e)
|
||||
else
|
||||
return "" -- equipment only command
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------
|
||||
|
||||
local function isSF(msg,s,f)
|
||||
return msg.header.secsStream == s and msg.header.secsFunction == f
|
||||
end
|
||||
|
||||
local function isSxF0(msg)
|
||||
return msg.header.secsFunction == 0
|
||||
end
|
||||
|
||||
local function isS5Fx(msg)
|
||||
dumpMsg(msg)
|
||||
return msg.header.secsStream == 5
|
||||
end
|
||||
|
||||
local function isS9Fx(msg)
|
||||
dumpMsg(msg)
|
||||
return msg.header.secsStream == 9
|
||||
end
|
||||
|
||||
SECS_IO.onProcessRequest (
|
||||
function(buf)
|
||||
local request = parseMsg(buf)
|
||||
io.stderr:write("SECS II: ID: ",request.header.secsId,"\n")
|
||||
local s = request.header.secsStream
|
||||
local f = request.header.secsFunction
|
||||
io.stderr:write("SECS II: onProcessMsg ".."S"..s.."F"..f.."\n");
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
if not request.header.wait then
|
||||
SECS_IO.stopTransaction()
|
||||
end
|
||||
|
||||
local sig = msgSignature(request)
|
||||
|
||||
if isSF(request,1,1) then
|
||||
onPrimaryMsg(1,1,"are you there received")
|
||||
SECS_IO.sendMsg(S1F2(request.header))
|
||||
elseif isSF(request,1,2) then
|
||||
onSecondaryMsg(1,2,"are you there received akn")
|
||||
elseif isSF(request,1,13) then
|
||||
connected = true;
|
||||
onPrimaryMsg(1,13,"establish communication request received")
|
||||
--io.stderr:write(string.format("CONNECTED %d\n",request[1][1][2]));
|
||||
SECS_IO.sendMsg(S1F14(request.header))
|
||||
elseif isSF(request,1,14) then
|
||||
connected = true;
|
||||
onSecondaryMsg(1,14,"establish communication request received akn")
|
||||
--io.stderr:write(string.format("CONNECTED %d\n",request[1][1][2]));
|
||||
elseif isSF(request,2,41) then
|
||||
--print("SECS II: Message ",#request)
|
||||
onProcessMsg(request)
|
||||
onPrimaryMsg(2,41,"host command received")
|
||||
SECS_IO.sendMsg(S2F42(request.header))
|
||||
elseif isSF(request,2,42) then
|
||||
onProcessMsg(request)
|
||||
onSecondaryMsg(2,42,"host command received akn")
|
||||
elseif isSF(request,6,11) then
|
||||
onProcessMsg(request)
|
||||
onPrimaryMsg(6,11,"event report received")
|
||||
SECS_IO.sendMsg(S6F12(request.header))
|
||||
elseif isSF(request,6,12) then
|
||||
onSecondaryMsg(6,12,"event report received akn")
|
||||
elseif isS5Fx(request) then
|
||||
onProcessMsg(request)
|
||||
--hexDumpString(buf)
|
||||
--io.stderr:write("SIG: "..sig.."\n")
|
||||
onPrimaryMsg(5,request.header.secsFunction,"alarm received")
|
||||
SECS_IO.sendMsg(S5F2(request.header))
|
||||
elseif isS9Fx(request) then
|
||||
-- no secondary message
|
||||
onProcessMsg(request)
|
||||
onPrimaryMsg(9,request.header.secsFunction,"error received")
|
||||
else
|
||||
if not isSxF0(request) then
|
||||
onPrimaryMsg(0,0,"abort transaction send")
|
||||
SECS_IO.sendMsg(SxF0(request.header))
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local function dequeMsg()
|
||||
local m = msgQueue[1]
|
||||
table.remove(msgQueue,1)
|
||||
return m
|
||||
end
|
||||
|
||||
local function queueMsg(msg)
|
||||
io.stderr:write("\n====\nSECS II: queueMsg\n====\n");
|
||||
table.insert(msgQueue,msg)
|
||||
end
|
||||
|
||||
local function poll()
|
||||
if not SECS_IO.isPending() and #msgQueue > 0 then
|
||||
-- if not pending and #msgQueue > 0 then
|
||||
io.stderr:write("\n====\nSECS II: dequeueMsg\n====\n");
|
||||
SECS_IO.startTransaction()
|
||||
SECS_IO.sendMsg(dequeMsg())
|
||||
end
|
||||
SECS_IO.poll()
|
||||
end;
|
||||
|
||||
local function setHost(mode)
|
||||
host = mode
|
||||
end
|
||||
|
||||
local function setId(id)
|
||||
secsId = id
|
||||
end
|
||||
|
||||
local function begin(device, baud)
|
||||
SECS_IO.begin(device,baud)
|
||||
io.stderr:write("begin\n")
|
||||
SECS_IO.stopTransaction()
|
||||
end
|
||||
|
||||
return {
|
||||
begin = begin;
|
||||
sendMsg = sendMsg;
|
||||
dumpMsg = dumpMsg;
|
||||
msgSignature = msgSignature;
|
||||
msgData = msgData;
|
||||
|
||||
--------- DEBUG only ----------------
|
||||
-- dataSignature = dataSignature;
|
||||
-- parseMsg = parseMsg;
|
||||
-- dumpData = dumpData;
|
||||
-- parseData = parseData;
|
||||
|
||||
-- packString = packString;
|
||||
-- packBinary = packBinary;
|
||||
-- packList = packList;
|
||||
-- packData = packData;
|
||||
--------------------------------------
|
||||
|
||||
primaryMsg = primaryMsg;
|
||||
secondaryMsg = secondaryMsg;
|
||||
|
||||
setId = setId;
|
||||
setHost = setHost;
|
||||
isHost = function() return host end;
|
||||
|
||||
isConnected = function() return connected end;
|
||||
isReading = function() return SECS_IO.isReading() end;
|
||||
isWriting = function() return SECS_IO.isWriting() end;
|
||||
isPending = function() return SECS_IO.isPending() end;
|
||||
|
||||
poll = poll;
|
||||
|
||||
sendS1F13 = function() queueMsg(S1F13()) end;
|
||||
sendS1F1 = function() queueMsg(S1F1()) end;
|
||||
sendS2F41 = function(c) queueMsg(S2F41(c)) end;
|
||||
sendS6F11 = function(e) queueMsg(S6F11(e)) end;
|
||||
|
||||
onCreateMsg = function(cb) onCreateMsg = cb end;
|
||||
onPrimaryMsg = function(cb) onPrimaryMsg = cb end;
|
||||
onSecondaryMsg = function(cb) onSecondaryMsg = cb end;
|
||||
onProcessMsg = function(cb) onProcessMsg = cb end;
|
||||
}
|
||||
31
2B+Software/app/shm.lua
Normal file
31
2B+Software/app/shm.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
PLC = require('vwago')
|
||||
|
||||
plc = PLC.VWago("wago")
|
||||
|
||||
function setup()
|
||||
if ( plc ) then
|
||||
print("OK")
|
||||
end
|
||||
end
|
||||
|
||||
function loop()
|
||||
if ( plc ) then
|
||||
i = plc:getDouble(1)
|
||||
plc:setDouble(0,i)
|
||||
i = i + 1234
|
||||
if i > 2147483647 then
|
||||
i = 0
|
||||
o = plc:getDouble(2)
|
||||
plc:setDouble(2,o+1)
|
||||
end
|
||||
plc:setDouble(1,i)
|
||||
plc:update()
|
||||
print(i)
|
||||
end
|
||||
end
|
||||
|
||||
setup()
|
||||
|
||||
while 1 do
|
||||
loop()
|
||||
end
|
||||
114
2B+Software/app/st.lua
Normal file
114
2B+Software/app/st.lua
Normal file
@@ -0,0 +1,114 @@
|
||||
periphery = require('periphery')
|
||||
Serial = periphery.Serial
|
||||
|
||||
serial = Serial("/dev/ttyAMA0",9600)
|
||||
|
||||
COMMAND_POSITION = 0x19
|
||||
COMMAND_POSITION_X = 0x13
|
||||
COMMAND_POSITION_Y = 0x11
|
||||
|
||||
COMMAND_01H = 0x01
|
||||
COMMAND_03H = 0x03
|
||||
|
||||
COMMAND_CURSOR_OFF = 0x0E
|
||||
|
||||
COMMAND_BLINK = 0x0B
|
||||
COMMAND_UNBLINK = 0x0C
|
||||
|
||||
COMMAND_CR = 0x0D
|
||||
COMMAND_LF = 0x0A
|
||||
|
||||
blinkFlag = false
|
||||
|
||||
posX = 0
|
||||
posY = 0
|
||||
|
||||
function checkY(y)
|
||||
if y < 0 then
|
||||
y = 0
|
||||
end
|
||||
if y > 5 then
|
||||
y = 5
|
||||
end
|
||||
posY = y
|
||||
return y
|
||||
end
|
||||
|
||||
function checkX(x)
|
||||
if x < 0 then
|
||||
x = 39;
|
||||
posY = posY - 1
|
||||
checkY(posY)
|
||||
end
|
||||
if x > 39 then
|
||||
if posY == 5 then
|
||||
x = 39;
|
||||
else
|
||||
x = 0;
|
||||
posY = posY + 1
|
||||
checkY(posY);
|
||||
end
|
||||
end
|
||||
posX = x
|
||||
return x
|
||||
end
|
||||
|
||||
function gotoXY(x,y)
|
||||
checkX(x);
|
||||
checkY(y);
|
||||
end
|
||||
|
||||
function lineFeed(void)
|
||||
posY = posY + 1
|
||||
gotoXY(posX, checkY(posY));
|
||||
end
|
||||
|
||||
function carriageReturn(void)
|
||||
gotoXY(0, posY);
|
||||
end
|
||||
|
||||
while (1) do
|
||||
while serial:poll(100) do
|
||||
local c = serial:read(1)
|
||||
if c:byte() == COMMAND_POSITION then
|
||||
local cmd = serial:read(1)
|
||||
if cmd:byte() == COMMAND_POSITION_X then
|
||||
local x = string.byte(serial:read(1))
|
||||
gotoXY(x,posY)
|
||||
elseif cmd:byte() == COMMAND_POSITION_Y then
|
||||
local y = string.byte(serial:read(1))
|
||||
gotoXY(posX,y)
|
||||
end
|
||||
elseif c:byte() == COMMAND_03H then
|
||||
serial:read(1)
|
||||
serial:read(1)
|
||||
elseif c:byte() == COMMAND_BLINK then
|
||||
blinkFlag = true
|
||||
elseif c:byte() == COMMAND_UNBLINK then
|
||||
blinkFlag = false
|
||||
elseif c:byte() == COMMAND_CURSOR_OFF then
|
||||
-- curs_set(0);
|
||||
elseif c:byte() == COMMAND_CR then
|
||||
carriageReturn()
|
||||
elseif c:byte() == COMMAND_LF then
|
||||
lineFeed()
|
||||
else
|
||||
if c:byte() >= 0x20 and c:byte() < 0x7F then
|
||||
print(c.." at "..posX.." "..posY.."\n")
|
||||
posX = posX + 1
|
||||
checkX(posX)
|
||||
--[[
|
||||
if ( c >= 0x20 && c < 0x7F ) {
|
||||
(c==buf_char[y_now][x_now])?(buf_chng[y_now][x_now]='n'):(buf_chng[y_now][x_now]='y');
|
||||
(BLINK_FLAG?(buf_args[y_now][x_now] = 'b'):( buf_args[y_now][x_now] = 'n'));
|
||||
buf_char[y_now][x_now] = c;
|
||||
checkX(++x_now);
|
||||
--]]
|
||||
else
|
||||
print("Unknown: "..c:byte().."\n");
|
||||
end
|
||||
end
|
||||
--
|
||||
-- io.stderr:write(string.format('%02X ',c:byte(1)));
|
||||
end
|
||||
end
|
||||
197
2B+Software/app/struct.lua
Normal file
197
2B+Software/app/struct.lua
Normal file
@@ -0,0 +1,197 @@
|
||||
--[[
|
||||
* Copyright (c) 2015-2017 Iryont <https://github.com/iryont/lua-struct>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
]]
|
||||
|
||||
struct = {}
|
||||
|
||||
function struct.pack(format, ...)
|
||||
local stream = {}
|
||||
local vars = {...}
|
||||
local endianness = true
|
||||
|
||||
for i = 1, format:len() do
|
||||
local opt = format:sub(i, i)
|
||||
|
||||
if opt == '<' then
|
||||
endianness = true
|
||||
elseif opt == '>' then
|
||||
endianness = false
|
||||
elseif opt:find('[bBhHiIlL]') then
|
||||
local n = opt:find('[hH]') and 2 or opt:find('[iI]') and 4 or opt:find('[lL]') and 8 or 1
|
||||
local val = tonumber(table.remove(vars, 1))
|
||||
|
||||
local bytes = {}
|
||||
for j = 1, n do
|
||||
table.insert(bytes, string.char(val % (2 ^ 8)))
|
||||
val = math.floor(val / (2 ^ 8))
|
||||
end
|
||||
|
||||
if not endianness then
|
||||
table.insert(stream, string.reverse(table.concat(bytes)))
|
||||
else
|
||||
table.insert(stream, table.concat(bytes))
|
||||
end
|
||||
elseif opt:find('[fd]') then
|
||||
local val = tonumber(table.remove(vars, 1))
|
||||
local sign = 0
|
||||
|
||||
if val < 0 then
|
||||
sign = 1
|
||||
val = -val
|
||||
end
|
||||
|
||||
local mantissa, exponent = math.frexp(val)
|
||||
if val == 0 then
|
||||
mantissa = 0
|
||||
exponent = 0
|
||||
else
|
||||
mantissa = (mantissa * 2 - 1) * math.ldexp(0.5, (opt == 'd') and 53 or 24)
|
||||
exponent = exponent + ((opt == 'd') and 1022 or 126)
|
||||
end
|
||||
|
||||
local bytes = {}
|
||||
if opt == 'd' then
|
||||
val = mantissa
|
||||
for i = 1, 6 do
|
||||
table.insert(bytes, string.char(math.floor(val) % (2 ^ 8)))
|
||||
val = math.floor(val / (2 ^ 8))
|
||||
end
|
||||
else
|
||||
table.insert(bytes, string.char(math.floor(mantissa) % (2 ^ 8)))
|
||||
val = math.floor(mantissa / (2 ^ 8))
|
||||
table.insert(bytes, string.char(math.floor(val) % (2 ^ 8)))
|
||||
val = math.floor(val / (2 ^ 8))
|
||||
end
|
||||
|
||||
table.insert(bytes, string.char(math.floor(exponent * ((opt == 'd') and 16 or 128) + val) % (2 ^ 8)))
|
||||
val = math.floor((exponent * ((opt == 'd') and 16 or 128) + val) / (2 ^ 8))
|
||||
table.insert(bytes, string.char(math.floor(sign * 128 + val) % (2 ^ 8)))
|
||||
val = math.floor((sign * 128 + val) / (2 ^ 8))
|
||||
|
||||
if not endianness then
|
||||
table.insert(stream, string.reverse(table.concat(bytes)))
|
||||
else
|
||||
table.insert(stream, table.concat(bytes))
|
||||
end
|
||||
elseif opt == 's' then
|
||||
table.insert(stream, tostring(table.remove(vars, 1)))
|
||||
table.insert(stream, string.char(0))
|
||||
elseif opt == 'c' then
|
||||
local n = format:sub(i + 1):match('%d+')
|
||||
local length = tonumber(n)
|
||||
|
||||
if length > 0 then
|
||||
local str = tostring(table.remove(vars, 1))
|
||||
if length - str:len() > 0 then
|
||||
str = str .. string.rep(' ', length - str:len())
|
||||
end
|
||||
table.insert(stream, str:sub(1, length))
|
||||
end
|
||||
i = i + n:len()
|
||||
end
|
||||
end
|
||||
|
||||
return table.concat(stream)
|
||||
end
|
||||
|
||||
function struct.unpack(format, stream)
|
||||
local vars = {}
|
||||
local iterator = 1
|
||||
local endianness = true
|
||||
|
||||
for i = 1, format:len() do
|
||||
local opt = format:sub(i, i)
|
||||
|
||||
if opt == '<' then
|
||||
endianness = true
|
||||
elseif opt == '>' then
|
||||
endianness = false
|
||||
elseif opt:find('[bBhHiIlL]') then
|
||||
local n = opt:find('[hH]') and 2 or opt:find('[iI]') and 4 or opt:find('[lL]') and 8 or 1
|
||||
local signed = opt:lower() == opt
|
||||
|
||||
local val = 0
|
||||
for j = 1, n do
|
||||
local byte = string.byte(stream:sub(iterator, iterator))
|
||||
if endianness then
|
||||
val = val + byte * (2 ^ ((j - 1) * 8))
|
||||
else
|
||||
val = val + byte * (2 ^ ((n - j) * 8))
|
||||
end
|
||||
iterator = iterator + 1
|
||||
end
|
||||
|
||||
if signed and val >= 2 ^ (n * 8 - 1) then
|
||||
val = val - 2 ^ (n * 8)
|
||||
end
|
||||
|
||||
table.insert(vars, val)
|
||||
elseif opt:find('[fd]') then
|
||||
local n = (opt == 'd') and 8 or 4
|
||||
local x = stream:sub(iterator, iterator + n - 1)
|
||||
iterator = iterator + n
|
||||
|
||||
if not endianness then
|
||||
x = string.reverse(x)
|
||||
end
|
||||
|
||||
local sign = 1
|
||||
local mantissa = string.byte(x, (opt == 'd') and 7 or 3) % ((opt == 'd') and 16 or 128)
|
||||
for i = n - 2, 1, -1 do
|
||||
mantissa = mantissa * (2 ^ 8) + string.byte(x, i)
|
||||
end
|
||||
|
||||
if string.byte(x, n) > 127 then
|
||||
sign = -1
|
||||
end
|
||||
|
||||
local exponent = (string.byte(x, n) % 128) * ((opt == 'd') and 16 or 2) + math.floor(string.byte(x, n - 1) / ((opt == 'd') and 16 or 128))
|
||||
if exponent == 0 then
|
||||
table.insert(vars, 0.0)
|
||||
else
|
||||
mantissa = (math.ldexp(mantissa, (opt == 'd') and -52 or -23) + 1) * sign
|
||||
table.insert(vars, math.ldexp(mantissa, exponent - ((opt == 'd') and 1023 or 127)))
|
||||
end
|
||||
elseif opt == 's' then
|
||||
local bytes = {}
|
||||
for j = iterator, stream:len() do
|
||||
if stream:sub(j, j) == string.char(0) then
|
||||
break
|
||||
end
|
||||
|
||||
table.insert(bytes, stream:sub(j, j))
|
||||
end
|
||||
|
||||
local str = table.concat(bytes)
|
||||
iterator = iterator + str:len() + 1
|
||||
table.insert(vars, str)
|
||||
elseif opt == 'c' then
|
||||
local n = format:sub(i + 1):match('%d+')
|
||||
table.insert(vars, stream:sub(iterator, iterator + tonumber(n)-1))
|
||||
iterator = iterator + tonumber(n)
|
||||
i = i + n:len()
|
||||
end
|
||||
end
|
||||
|
||||
return unpack(vars)
|
||||
end
|
||||
|
||||
return struct
|
||||
18
2B+Software/app/tabs.lua
Normal file
18
2B+Software/app/tabs.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
tabs = {
|
||||
{class="ShellCommandWidget", title="Info", args={"cat","/mnt/info.txt"} },
|
||||
{class="ConfigSystemWidget", title="System"},
|
||||
{class="ProcessStateWidget", title="ps"},
|
||||
-- {class="ShellCommandWidget", title="MB", args={"mb","-rd","localhost"} },
|
||||
-- {class="ProcessStateWidget", title="ps"},
|
||||
{class="TailFileWidget", title="Log"},
|
||||
-- {class="ScriptProgrammerWidget", title="ELFI Script"},
|
||||
-- {class="RemoteProgrammerWidget", title="AVRDude"},
|
||||
-- {class="LuaProgrammerWidget", title="LUA Script"},
|
||||
{class="LuaAdminWidget", title="LUA Admin"},
|
||||
{class="AceEditorWidget", title="Lua ACE 1"},
|
||||
{class="AceEditorWidget", title="Lua ACE 2"},
|
||||
{class="AceEditorWidget", title="Lua ACE 3"},
|
||||
{class="AceEditorWidget", title="HTML ACE 1", args={"/mnt/www","",".html","html"}},
|
||||
-- {class="RemoteContainerWidget", title="Lua Shell", args={"http://192.168.9.101:4200"}}
|
||||
{class="RemoteContainerWidget", title="Lua Shell"}
|
||||
}
|
||||
9
2B+Software/app/ti.lua
Normal file
9
2B+Software/app/ti.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
Scheduler = require('scheduler')
|
||||
|
||||
updateTimer = Scheduler.Timer(5000)
|
||||
oneSecond = Scheduler.Timer(1000)
|
||||
|
||||
while updateTimer:running() do
|
||||
if oneSecond:elapsed() then print("1 Sekunde") end
|
||||
end
|
||||
|
||||
45
2B+Software/app/touch.lua
Normal file
45
2B+Software/app/touch.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
local evdev = require "evdev"
|
||||
|
||||
local dev = evdev.Device("/dev/input/event0")
|
||||
|
||||
local x = 0
|
||||
local y = 0
|
||||
local cnt = 0
|
||||
|
||||
|
||||
|
||||
while true do
|
||||
--local timestamp, eventType, eventCode, value = dev:read()
|
||||
--print(dev:avail())
|
||||
if dev:avail() > 0 then
|
||||
local timestamp, eventType, eventCode, value = dev:read()
|
||||
|
||||
if eventType == evdev.EV_ABS then
|
||||
if eventCode == 57 then
|
||||
if value < 0 then
|
||||
if y > 0 and y < 79 then
|
||||
print("Ctrl1: ",math.floor(x/80)+1)
|
||||
end
|
||||
if y > 400 and y < 479 then
|
||||
print("Ctrl2: ",math.floor(x/80)+1)
|
||||
end
|
||||
if y > 320 and y < 399 then
|
||||
print("Numbs: ",math.floor(x/80)+1)
|
||||
end
|
||||
if y > 80 and y < 319 then
|
||||
-- print("Lines: ",math.floor(y/((320-80)/6))-1,math.floor(x/20)+1,x,y,math.floor((y-80)/240*10+6),math.floor(x/465*23+5))
|
||||
print("Lines: ",math.floor((y-80)/240*10+6),math.floor(x/720*36+7))
|
||||
end
|
||||
end
|
||||
elseif eventCode == 0 then
|
||||
x = value
|
||||
elseif eventCode == 1 then
|
||||
y = value
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
cnt = cnt + 1
|
||||
end
|
||||
|
||||
end
|
||||
9
2B+Software/app/tr.lua
Normal file
9
2B+Software/app/tr.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
-- tr["<Variante>"] = "<Rezeptnummer"
|
||||
|
||||
tr["1T1"] = "20"
|
||||
tr["1T2"] = "21"
|
||||
tr["2T1"] = "22"
|
||||
tr["2T3"] = "23"
|
||||
tr["1D6"] = "65"
|
||||
tr["2D6"] = "66"
|
||||
tr["2B7"] = "63"
|
||||
1
2B+Software/backup.idx
Normal file
1
2B+Software/backup.idx
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
11
2B+Software/backup.sh
Normal file
11
2B+Software/backup.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#! /bin/sh
|
||||
|
||||
let idx=$(cat /mnt/backup.idx)
|
||||
mkdir /mnt/archive/root_$idx.bak
|
||||
mkdir /mnt/archive/www_$idx.bak
|
||||
cp -a /root/* /mnt/archive/root_$idx.bak
|
||||
cp -a /mnt/www/panel /mnt/archive/www_$idx.bak
|
||||
let nxt=$idx+1
|
||||
echo $nxt > /mnt/backup.idx
|
||||
|
||||
|
||||
BIN
2B+Software/bcm2708-rpi-0-w.dtb
Normal file
BIN
2B+Software/bcm2708-rpi-0-w.dtb
Normal file
Binary file not shown.
BIN
2B+Software/bcm2708-rpi-b-plus.dtb
Normal file
BIN
2B+Software/bcm2708-rpi-b-plus.dtb
Normal file
Binary file not shown.
BIN
2B+Software/bcm2708-rpi-b.dtb
Normal file
BIN
2B+Software/bcm2708-rpi-b.dtb
Normal file
Binary file not shown.
BIN
2B+Software/bcm2708-rpi-cm.dtb
Normal file
BIN
2B+Software/bcm2708-rpi-cm.dtb
Normal file
Binary file not shown.
BIN
2B+Software/bcm2709-rpi-2-b.dtb
Normal file
BIN
2B+Software/bcm2709-rpi-2-b.dtb
Normal file
Binary file not shown.
BIN
2B+Software/bcm2710-rpi-3-b.dtb
Normal file
BIN
2B+Software/bcm2710-rpi-3-b.dtb
Normal file
Binary file not shown.
BIN
2B+Software/bcm2710-rpi-cm3.dtb
Normal file
BIN
2B+Software/bcm2710-rpi-cm3.dtb
Normal file
Binary file not shown.
BIN
2B+Software/bootcode.bin
Normal file
BIN
2B+Software/bootcode.bin
Normal file
Binary file not shown.
1
2B+Software/cmdline.txt
Normal file
1
2B+Software/cmdline.txt
Normal file
@@ -0,0 +1 @@
|
||||
rootwait console=tty1
|
||||
1
2B+Software/cmdline_AMA0.txt
Normal file
1
2B+Software/cmdline_AMA0.txt
Normal file
@@ -0,0 +1 @@
|
||||
rootwait console=tty1 console=ttyAMA0,115200
|
||||
1
2B+Software/cmdline_console.txt
Normal file
1
2B+Software/cmdline_console.txt
Normal file
@@ -0,0 +1 @@
|
||||
rootwait console=ttyAMA0,115200
|
||||
1
2B+Software/cmdline_tft_touch.txt
Normal file
1
2B+Software/cmdline_tft_touch.txt
Normal file
@@ -0,0 +1 @@
|
||||
rootwait consoleblank=0 fbcon=map:10 fbcon=font:VGA8x8 fbtft.dma fbtft_device.custom fbtft_device.name=fb_ili9341 fbtft_device.busnum=0 fbtft_device.cs=0 fbtft_device.speed=10000000 fbtft_device.gpios=reset:27,dc:22 fbtft_device.bgr=1 fbtft_device.rotate=270 console=tty1
|
||||
1
2B+Software/cmdline_tty1.txt
Normal file
1
2B+Software/cmdline_tty1.txt
Normal file
@@ -0,0 +1 @@
|
||||
rootwait console=tty1
|
||||
26
2B+Software/config.txt
Normal file
26
2B+Software/config.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
# Please note that this is only a sample, we recommend you to change it to fit
|
||||
# your needs.
|
||||
# You should override this file using a post-build script.
|
||||
# See http://buildroot.org/manual.html#rootfs-custom
|
||||
# and http://elinux.org/RPiconfig for a description of config.txt syntax
|
||||
|
||||
kernel=zImage
|
||||
|
||||
# To use an external initramfs file
|
||||
#initramfs rootfs.cpio.gz
|
||||
|
||||
# Disable overscan assuming the display supports displaying the full resolution
|
||||
# If the text shown on the screen disappears off the edge, comment this out
|
||||
disable_overscan=1
|
||||
|
||||
# How much memory in MB to assign to the GPU on Pi models having
|
||||
# 256, 512 or 1024 MB total memory
|
||||
gpu_mem_256=100
|
||||
gpu_mem_512=100
|
||||
gpu_mem_1024=100
|
||||
|
||||
dtparam=spi=on
|
||||
# dtparam=i2c_arm=on
|
||||
|
||||
enable_serial=1
|
||||
|
||||
BIN
2B+Software/custom_cpio.gz
(Stored with Git LFS)
Normal file
BIN
2B+Software/custom_cpio.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/fixup.dat
(Stored with Git LFS)
Normal file
BIN
2B+Software/fixup.dat
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/fixup_cd.dat
(Stored with Git LFS)
Normal file
BIN
2B+Software/fixup_cd.dat
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/fixup_db.dat
(Stored with Git LFS)
Normal file
BIN
2B+Software/fixup_db.dat
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/fixup_x.dat
(Stored with Git LFS)
Normal file
BIN
2B+Software/fixup_x.dat
(Stored with Git LFS)
Normal file
Binary file not shown.
1
2B+Software/hostname.ini
Normal file
1
2B+Software/hostname.ini
Normal file
@@ -0,0 +1 @@
|
||||
touch_xx
|
||||
24
2B+Software/info.txt
Normal file
24
2B+Software/info.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1><center>"Buildroot-2017"</center></h1>
|
||||
<hr>
|
||||
<ul><li><h2>Ausführliche Dokumentation</h2>
|
||||
<a target="_blank" type="application/pdf" href="elfi40_overview.pdf">ELFI Handbuch PDF (deutsch)</a>
|
||||
<a target="_blank" type="application/pdf" href="manual.pdf">Aligner Handbuch PDF (deutsch)</a>
|
||||
<a target="_blank" href="lua.html">Lua Einführung Html (deutsch)</a>
|
||||
<a target="_blank" type="application/pdf" href="lua.pdf">Lua Einführung PDF (deutsch)</a>
|
||||
<a target="_blank" type="application/pdf" href="lua52_reference.pdf">Lua 5.2 Reference PDF (englisch)</a>
|
||||
</li>
|
||||
<li><h2>TAB ps</h2></li>
|
||||
Aktuelle Prozessstatusliste, zur Überprüfung des Systems
|
||||
<li><h2>TAB Log</h2></li>
|
||||
Ansicht der letzten Einträge im Logfile der Anwendung
|
||||
<li><h2>TAB System</h2></li>
|
||||
Alle Einstellungen die das Basissystem betreffen, Netzwerk und Firmware sowie Systemreboot
|
||||
<li><h2>TAB LUA Admin</h2></li>
|
||||
Editieren der LUA Konfigurationsdateien
|
||||
<li><h2>TAB LUA ACE</h2></li>
|
||||
Editieren der LUA Programmdateien
|
||||
<li><h2>TAB LUA Shell</h2></li>
|
||||
Remote Shell Login
|
||||
</ul>
|
||||
<hr>
|
||||
<b><font color="#FF0000">Einige Funktionen sind aus Sicherheitsgründen nur nach einem Login und im Adminmodus erreichbar!</font></b><br>
|
||||
8
2B+Software/interfaces.ini
Normal file
8
2B+Software/interfaces.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
hostname $(hostname)
|
||||
#address 192.168.9.100
|
||||
#netmask 255.255.255.0
|
||||
#gateway 192.168.9.1
|
||||
1511
2B+Software/overlays/README
Normal file
1511
2B+Software/overlays/README
Normal file
File diff suppressed because it is too large
Load Diff
BIN
2B+Software/overlays/adau1977-adc.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/adau1977-adc.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/adau7002-simple.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/adau7002-simple.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/ads1015.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/ads1015.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/ads1115.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/ads1115.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/ads7846.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/ads7846.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/akkordion-iqdacplus.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/akkordion-iqdacplus.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/allo-boss-dac-pcm512x-audio.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/allo-boss-dac-pcm512x-audio.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/allo-piano-dac-pcm512x-audio.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/allo-piano-dac-pcm512x-audio.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/allo-piano-dac-plus-pcm512x-audio.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/allo-piano-dac-plus-pcm512x-audio.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/at86rf233.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/at86rf233.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/audioinjector-addons.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/audioinjector-addons.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/audioinjector-wm8731-audio.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/audioinjector-wm8731-audio.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/audremap.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/audremap.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/bmp085_i2c-sensor.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/bmp085_i2c-sensor.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/dht11.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/dht11.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/dionaudio-loco-v2.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/dionaudio-loco-v2.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/dionaudio-loco.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/dionaudio-loco.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/dpi18.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/dpi18.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/dpi24.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/dpi24.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/dwc-otg.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/dwc-otg.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/dwc2.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/dwc2.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/enc28j60-spi2.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/enc28j60-spi2.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/enc28j60.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/enc28j60.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/fe-pi-audio.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/fe-pi-audio.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/googlevoicehat-soundcard.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/googlevoicehat-soundcard.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/gpio-ir.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/gpio-ir.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/gpio-poweroff.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/gpio-poweroff.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/hifiberry-amp.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/hifiberry-amp.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/hifiberry-dac.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/hifiberry-dac.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/hifiberry-dacplus.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/hifiberry-dacplus.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/hifiberry-digi-pro.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/hifiberry-digi-pro.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/hifiberry-digi.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/hifiberry-digi.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/hy28a.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/hy28a.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/hy28b.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/hy28b.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2c-bcm2708.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2c-bcm2708.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2c-gpio.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2c-gpio.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2c-mux.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2c-mux.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2c-pwm-pca9685a.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2c-pwm-pca9685a.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2c-rtc.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2c-rtc.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2c-sensor.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2c-sensor.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2c0-bcm2708.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2c0-bcm2708.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2c1-bcm2708.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2c1-bcm2708.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/i2s-gpio28-31.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/i2s-gpio28-31.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/iqaudio-dac.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/iqaudio-dac.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/iqaudio-dacplus.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/iqaudio-dacplus.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/iqaudio-digi-wm8804-audio.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/iqaudio-digi-wm8804-audio.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/justboom-dac.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/justboom-dac.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/justboom-digi.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/justboom-digi.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/lirc-rpi.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/lirc-rpi.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/mcp23017.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/mcp23017.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
2B+Software/overlays/mcp23s17.dtbo
(Stored with Git LFS)
Normal file
BIN
2B+Software/overlays/mcp23s17.dtbo
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user