Commit 1afa113cf45a506b1de33fe71fb108756d761c6e

Authored by henyxia
1 parent c95bd3c4

Coffee is now ordered with the screen

Showing 1 changed file with 17 additions and 3 deletions   Show diff stats
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 #include "ui.h" 9 #include "ui.h"
10 #include "bus.h" 10 #include "bus.h"
11 #include "usb.h" 11 #include "usb.h"
  12 +#include "pump.h"
12 13
13 #define TIME_LENGTH 24 14 #define TIME_LENGTH 24
14 #define HEADER_TEXT_LENGTH 24 15 #define HEADER_TEXT_LENGTH 24
@@ -60,8 +61,9 @@ void setDebit(unsigned int d) @@ -60,8 +61,9 @@ void setDebit(unsigned int d)
60 61
61 int calculateInteraction(int act, int x, int y) 62 int calculateInteraction(int act, int x, int y)
62 { 63 {
63 - char filename[MAX_FILENAME_LENGTH];  
64 - FILE* f = NULL; 64 + char filename[MAX_FILENAME_LENGTH];
  65 + FILE* f = NULL;
  66 + unsigned char ret;
65 switch(act) 67 switch(act)
66 { 68 {
67 case SC_HOME: 69 case SC_HOME:
@@ -83,7 +85,19 @@ int calculateInteraction(int act, int x, int y) @@ -83,7 +85,19 @@ int calculateInteraction(int act, int x, int y)
83 85
84 fseek(f, x + y*320, SEEK_SET); 86 fseek(f, x + y*320, SEEK_SET);
85 87
86 - printx(DEBUG, UI, "Ret is %02X\n", fgetc(f)); 88 + ret = fgetc(f);
  89 + printx(DEBUG, UI, "Ret is %02X\n", ret);
  90 +
  91 + if(ret == 1)
  92 + {
  93 + setVolWanted(1);
  94 + setCoffeeWanted();
  95 + }
  96 + else if(ret == 2)
  97 + {
  98 + setVolWanted(2);
  99 + setCoffeeWanted();
  100 + }
87 101
88 fclose(f); 102 fclose(f);
89 103