Esempio n. 1
0
func (thisQue *orderQue_t) SyncInternal(queToSync orderQue_t) {
	for floor := FIRST_FLOOR; floor < N_FLOORS; floor++ {
		if queToSync[floor][CMD].lastChangeTime.After(thisQue[floor][CMD].lastChangeTime) {
			thisQue[floor][CMD] = queToSync[floor][CMD]
			driver.SetButtonLight(CMD, floor, thisQue[floor][CMD].hasOrder)
		}
	}
}
Esempio n. 2
0
func (thisQue *orderQue_t) SyncExternal(queToSync orderQue_t) {
	externalButtons := []int{UP, DOWN}
	for floor := FIRST_FLOOR; floor < N_FLOORS; floor++ {
		for _, orderType := range externalButtons {
			if queToSync[floor][orderType].lastChangeTime.After(thisQue[floor][orderType].lastChangeTime) {
				thisQue[floor][orderType] = queToSync[floor][orderType]
				driver.SetButtonLight(orderType, floor, thisQue[floor][orderType].hasOrder)
			}
		}
	}
}
Esempio n. 3
0
func (que *orderQue_t) RemoveOrder(button Button_t) {
	if DEBUG_QUE {
		fmt.Printf("que: RemoveOrder = %+v\n", button)
	}
	if que.HasOrder(button) {
		que[button.Floor][button.ButtonType].hasOrder = false
		que[button.Floor][button.ButtonType].lastChangeTime = time.Now()
		que[button.Floor][button.ButtonType].assignedToID = UNASIGNED_ID
		driver.SetButtonLight(button.ButtonType, button.Floor, false)
	}
	que.WriteToLog()
}