📄 zentrale.java
字号:
package kfl;/*** Zentrale Steuerung.* TODO: Automatik ausbauen.*/public class Zentrale { public static final int VER_MAJ = 0; public static final int VER_MIN = 9; private static int[] kflver;public static boolean auto; // fuer Testbetriebprivate static int autoTimer; // next Time for automaticprivate static final int AUTO_TIME = 8*60; public static void main(String[] args) { Timer.init(); Timer.wd();// wait to make shure that no wd reset apears and // make diplay dark againTimer.sleepWd(1000); // only for development with dl from MAX+PLUS Display.init(); Keyboard.init(); Flash.init(); Log.init(); Texte.init(); Temp.init(); Timer.wd();// Menu.init(); net notwendig Msg.init(0); Clock.init(); Timer.wd(); chkNot(); // zuerst auf Notaus ueberpruefenauto = false;autoTimer = 0;Timer.start();Menu.setDate(); init(); Timer.start(); Station.init(); Station.chkMS(); Display.line1(kflver); Display.line2(Texte.bereit); forever(); } private static void init() { int[] str = {'K', 'F', 'L', ' ', 'V', '0'+VER_MAJ, '.', '0'+VER_MIN}; kflver = str; Display.line1(kflver); Display.line2(Texte.empty); } public static void chkNot() { if ((JopSys.rd(BBSys.IO_TAST)&BBSys.BIT_TNOT) != 0) { JopSys.wr(0, BBSys.IO_TRIAC); // Schuetz off Display.line1(Texte.notaus); Log.write(Log.NOTSTOP); for (;;) { // do nothing after Not Stop Timer.wd(); } } } private static void forever() { int blinkCnt = 0; int val; int[] buf = new int[20]; int old_tast = 0; for (;;) { Keyboard.loop(); if (Keyboard.pressed) { if (Keyboard.rd()==Keyboard.B) { Menu.doit(); Display.line1(kflver); Display.line2(Texte.bereit); if (autoTimer<Clock.getSec()) { // a little delay after Menu autoTimer = Clock.getSec()+3; } } } chkNot(); // automatischer Testbetrieb if (auto) { if (autoTimer<Clock.getSec()) { if (Station.isUp()) { Station.down(); } else if (Station.isDown()) { Station.up(); } autoTimer = Clock.getSec()+AUTO_TIME; } // 'manueller' Betrieb } else { val = JopSys.rd(BBSys.IO_TAST); if (val == old_tast) { if ((val&BBSys.BIT_TAUF)!=0 && Station.upOk()) { Station.up(); autoTimer = Clock.getSec()+AUTO_TIME; } else if ((val&BBSys.BIT_TAB)!=0 && Station.downOk()) { Station.down(); autoTimer = Clock.getSec()+AUTO_TIME; } } else { old_tast = val; } autoTimer = Clock.getSec(); } if (blinkCnt==100) { Timer.wd(); blinkCnt = 0; } ++blinkCnt; if (Clock.loop()) { if (auto) { Clock.getDate(buf); Display.line2(buf); Display.line1(Texte.automatik); } } Timer.waitForNextInterval(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -