Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: RequestQueue.h
- Revision:
- 3:c3d716d6c6a7
- Parent:
- 2:2cc70773996b
- Child:
- 4:95fe80130442
--- a/RequestQueue.h Thu Mar 26 06:10:56 2015 +0000
+++ b/RequestQueue.h Thu Mar 26 23:41:44 2015 +0000
@@ -16,18 +16,36 @@
void add(int);
void remove(int);
int isRequested (int);
+ int isForwardRequested (int);
+ int isReverseRequested (int);
};
void RequestQueue::add (int i){
- floorRequests[i] = 1;
+ floorRequests[i-1] = 1;
}
void RequestQueue::remove (int i){
- floorRequests[i] = 0;
+ floorRequests[i-1] = 0;
}
int RequestQueue::isRequested (int i){
- return floorRequests[i];
+ return floorRequests[i-1];
+}
+
+int RequestQueue::isForwardRequested (int i){
+ for(int j = i; j<5; j++){
+ if(floorRequests[j] == 1)
+ return 1;
+ }
+ return 0;
+}
+
+int RequestQueue::isReverseRequested (int i){
+ for(int j = 0; j<i-1; j++){
+ if(floorRequests[j] == 1)
+ return 1;
+ }
+ return 0;
}
#endif
\ No newline at end of file