Sat, 25 Apr 2020 20:31:31 +0200
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * Copyright (C) 2015 |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of the mbsePi-apps |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * The gui code is based on the gui from the emulator ARAnyM, |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * Copyright (c) 2004 Petr Stehlik of ARAnyM dev team |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * mbsePi-apps is free software; you can redistribute it and/or modify it |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * under the terms of the GNU General Public License as published by the |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * Free Software Foundation; either version 2, or (at your option) any |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * later version. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * mbsePi-apps is distributed in the hope that it will be useful, but |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * General Public License for more details. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | * You should have received a copy of the GNU General Public License |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | * along with mbsePi-apps; see the file COPYING. If not, write to the Free |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | *****************************************************************************/ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | #include "brewpanel.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | #include "dlgBrew.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | #include "sdlgui.h" |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
29 | #include "slcd.h" |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
30 | #include "sockio.h" |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
31 | |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | |
410
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
33 | #ifdef HAVE_SDL_SDL_H |
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
34 | |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | extern SDL_Surface *PAN_surface; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | extern int my_shutdown; |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
429
diff
changeset
|
37 | extern int debug; |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
38 | extern uint16_t keys; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
41 | #define MAINDLG_QUIT 2 |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
42 | #define MAINDLG_B1 3 |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
43 | #define MAINDLG_B2 5 |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
44 | #define MAINDLG_B3 7 |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
45 | #define MAINDLG_B4 9 |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
46 | #define MAINDLG_B12 11 |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
47 | #define MAINDLG_B23 12 |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
48 | #define MAINDLG_B34 13 |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
49 | #define MAINDLG_BALL 14 |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | /* The main dialog: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | static SGOBJ maindlg[] = |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | { |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
55 | /* type flags state x y w h txt */ |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
56 | { SGBOX, 0, 0, 0, 0, 374, 470, NULL }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
57 | { SGLCD, 0, 0, -1, 44, 20, 4, NULL }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
58 | { SGBUTTON, 0, 0, 147, 430, 80, 20, (char *)"Quit" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
59 | { SGBUTTON, 0, 0, 80, 135, 30, 30, (char *)"1" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
60 | { SGTTF, 0, 0, 85, 170, 20, 20, (char *)"Up" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
61 | { SGBUTTON, 0, 0, 140, 135, 30, 30, (char *)"2" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
62 | { SGTTF, 0, 0, 135, 170, 20, 20, (char *)"Down" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
63 | { SGBUTTON, 0, 0, 200, 135, 30, 30, (char *)"3" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
64 | { SGTTF, 0, 0, 203, 170, 20, 20, (char *)"Ret" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
65 | { SGBUTTON, 0, 0, 260, 135, 30, 30, (char *)"4" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
66 | { SGTTF, 0, 0, 258, 170, 20, 20, (char *)"Enter" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
67 | { SGBUTTON, 0, 0, 110, 195, 30, 30, (char *)"12" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
68 | { SGBUTTON, 0, 0, 170, 195, 30, 30, (char *)"23" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
69 | { SGBUTTON, 0, 0, 230, 195, 30, 30, (char *)"34" }, |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
70 | { SGBUTTON, 0, 0, 170, 255, 30, 30, (char *)"All" }, |
429 | 71 | { SGLEDRED, 0, 0, 100, 350, 12, 0, NULL }, |
72 | { SGTTF, 0, 0, 60, 365, 20, 20, (char *)"HLT heat" }, | |
73 | { SGLEDBLUE, 0, 0, 190, 350, 12, 0, NULL }, | |
74 | { SGLEDYELLOW, 0, 0, 280, 350, 12, 0, NULL }, | |
75 | { SGTTF, 0, 0, 170, 365, 20, 20, (char *)"heat MLT pump" }, | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
76 | { -1, 0, 0, 0, 0, 0, 0, NULL } |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | }; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
81 | int Dialog_LCDinit(int *x, int *y, int *w, int *h, int *cols, int *rows, int index) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
82 | { |
429 | 83 | int retval = SDLGui_LCDinit(maindlg, x, y, w, h, cols, rows, index); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
84 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
85 | return retval; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
86 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
87 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
88 | |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | * This functions sets up the actual font and then displays the brew panel dialog. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | */ |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
93 | int Dialog_BrewDlg(int fermenter) |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | int retbut; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | int bOldMouseVisibility; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | int nOldMouseX, nOldMouseY; |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
98 | int x, y, w, h, cols, rows, fd; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | if (SDLGui_SetScreen(PAN_surface)) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | syslog(LOG_NOTICE, "SDLGui_SetScreen(PAN_surface) failed: %s", SDL_GetError()); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | return FALSE; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | SDL_GetMouseState(&nOldMouseX, &nOldMouseY); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | bOldMouseVisibility = SDL_ShowCursor(SDL_QUERY); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | SDL_ShowCursor(SDL_ENABLE); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | |
429 | 109 | /* |
110 | * Patch the main dialog if the fermenter panel should be shown. | |
111 | */ | |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
112 | if (fermenter == 1) { |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
113 | maindlg[1].w = 16; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
114 | maindlg[1].h = 2; |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
115 | maindlg[7].type = SGLEDGREEN; |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
116 | maindlg[7].x = 218; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
117 | maindlg[7].y = 153; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
118 | maindlg[7].w = 12; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
119 | maindlg[8].txt = (char *)""; |
427
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
120 | maindlg[12].type = -1; |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
121 | } |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
122 | |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | SDLGui_CenterDlg(maindlg); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
124 | SDLGui_DoDialogInit(maindlg); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
125 | fd = Dialog_LCDinit(&x, &y, &w, &h, &cols, &rows, 0); |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
429
diff
changeset
|
126 | if (debug) |
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
429
diff
changeset
|
127 | fprintf(stdout, "Dialog_LCDinit(%d, %d, %d, %d, %d, %d, 0) = %d\n", x, y, w, h, cols, rows, fd); |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
416
diff
changeset
|
128 | socket_connect(); |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
129 | slcdInit(maindlg, fd, x, y, w, h, cols, rows); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
131 | do { |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
132 | retbut = SDLGui_DoDialogLoop(maindlg); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | switch (retbut) { |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
135 | case MAINDLG_B1 + 1000: |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
136 | keys |= 0x0008; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
137 | break; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
138 | case MAINDLG_B1: |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
139 | keys &= ~0x0008; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | break; |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
141 | case MAINDLG_B2 + 1000: |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
142 | keys |= 0x0004; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
143 | break; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
144 | case MAINDLG_B2: |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
145 | keys &= ~0x0004; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | break; |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
147 | case MAINDLG_B3 + 1000: |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
148 | keys |= 0x0002; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
149 | break; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
150 | case MAINDLG_B3: |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
151 | keys &= ~0x0002; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | break; |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
153 | case MAINDLG_B4 + 1000: |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
154 | keys |= 0x0001; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
155 | break; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
156 | case MAINDLG_B4: |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
157 | keys &= ~0x0001; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | break; |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
159 | case MAINDLG_B12 + 1000: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
160 | keys |= 0x000c; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
161 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
162 | case MAINDLG_B12: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
163 | keys &= ~0x000c; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
164 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
165 | case MAINDLG_B23 + 1000: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
166 | keys |= 0x0006; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
167 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
168 | case MAINDLG_B23: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
169 | keys &= ~0x0006; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
170 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
171 | case MAINDLG_B34 + 1000: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
172 | keys |= 0x0003; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
173 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
174 | case MAINDLG_B34: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
175 | keys &= ~0x0003; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
176 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
177 | case MAINDLG_BALL + 1000: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
178 | keys |= 0x000f; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
179 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
180 | case MAINDLG_BALL: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
181 | keys &= ~0x000f; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
182 | break; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | case MAINDLG_QUIT: my_shutdown = TRUE; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
184 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
185 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
186 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
187 | } while (retbut != SDLGUI_QUIT && retbut != SDLGUI_ERROR && !my_shutdown); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
188 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
189 | SDLGui_DoDialogEnd(); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
190 | SDL_ShowCursor(bOldMouseVisibility); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
191 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
192 | return TRUE; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
193 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
194 | |
410
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
195 | #endif |