GUIs and Menus
TC
Posts: 1,019
Hello all,
I am STILL working on my reflow oven. I am trying to make the menu more efficient. I have took advise from others here, but because I keep adding things, I am getting lost. I am trying to make a method/object that will handle the GUI, display, encoder, and audio. I thought of following the idea of the WMF framework, but I am getting lost on how to start. I have the encoder (and select) and the audio figured out, But that is as far as I can get.
I just really need some advice, ideas, anything to get my butt in gear and get this reflow oven done.
Thanks
TC
Encoder code;
Audio code:
I am STILL working on my reflow oven. I am trying to make the menu more efficient. I have took advise from others here, but because I keep adding things, I am getting lost. I am trying to make a method/object that will handle the GUI, display, encoder, and audio. I thought of following the idea of the WMF framework, but I am getting lost on how to start. I have the encoder (and select) and the audio figured out, But that is as far as I can get.
I just really need some advice, ideas, anything to get my butt in gear and get this reflow oven done.
Thanks
TC
Encoder code;
CON {-----------} { ENCODER } {-----------} ENCODER_DETE = 1 'ENCODER HAS DETENT ENCODER_LOW = 0 'ENCODER LOW LIMIT VALUE. OFFERS PADDING FOR ROLLOVER ENCODER_HIGH = 1000 'ENCODER HIGH LIMIT VALUE. OFFERS PADDING FOR ROLLOVER ENCODER_PRES = 100 'ENCODER STARTING VALUE. 100 IS CONSIDERED 0. THAT ALLOWS FOR PADDING FOR LESS THAN 0 OBJ ENCODER : "jm_grayenc2" VAR LONG SELECT_FLAG LONG ENCODER_LAST LONG ENCODER_VALUE PRI ENCODER_START ENCODER.START(ENCODER_A, ENCODER_DETE, ENCODER_LOW, ENCODER_HIGH, ENCODER_PRES) DIRA[ENCODER_SEL] := 0 PRI ENCODER_READ(AUDIO_FILE_UP, AUDIO_FILE_DOWN) {--------------------------------------} { READ ENCODER VALUE, AND PLAY AUDIO } {--------------------------------------} ENCODER_VALUE := ENCODER.READ ''READ THE ENCODER VALUE IF ENCODER_LAST == 0 ''IS THIS THE FIRST TIME THE ENCODER WAS READ? ENCODER_LAST := ENCODER_VALUE ''IF IT IS, SET LAST ENCODER VALUE TO CURRENT VALUE IF ENCODER_VALUE > ENCODER_LAST ''HAS THE ENCODER GONE UP? ENCODER_LAST := ENCODER_VALUE ''IF SO, SET LAST ENCODER VALUE IF AUDIO_FILE_UP <> NULL ''DOES AN AUDIO FILE NEED TO BE PLAYED? AUDIO_OVERRIDE(TRUE) ''OVERRIDE ANY AUDIO FILE BEING PLAYED AUDIO_PLAY(AUDIO_FILE_UP) ''LOAD NEW AUDIO FILE AUDIO_OVERRIDE(FALSE) ''PLAY NEW AUDIO FILE RETURN TRUE ''RETURN SAYING ENCODER VALUE CHANGED IF ENCODER_VALUE < ENCODER_LAST ''HAS THE ENCODER GONE DOWN? ENCODER_LAST := ENCODER_VALUE ''IF SO, SET LAST ENCODER VALUE IF AUDIO_FILE_DOWN <> NULL ''DOES AN AUDIO FILE NEED TO BE PLAYED? AUDIO_OVERRIDE(TRUE) ''OVERRIDE ANY AUDIO FILE BEING PLAYED AUDIO_PLAY(AUDIO_FILE_DOWN) ''LOAD NEW AUDIO FILE AUDIO_OVERRIDE(FALSE) ''PLAY NEW AUDIO FILE RETURN TRUE ''RETURN SAYING ENCODER VALUE CHANGED RETURN FALSE ''RETURN SAYING ENCODER VALUE DID NOT CHANGE PRI ENCODER_SELECT(AUDIO_FILE) {-----------------------------------------} { ENCODER SELECT CONTROL AND PLAY AUDIO } {-----------------------------------------} IF INA[ENCODER_SEL] == 0 AND SELECT_FLAG <> TRUE ''IS THE BUTTON PUSHED? WAS THE BUTTON PUSH BEFORE? SELECT_FLAG := TRUE ''FLAG AS BUTTON WAS PUSHED IF AUDIO_FILE <> NULL ''DOES AN AUDIO FILE NEED TO BE PLAYED? AUDIO_PLAY(AUDIO_FILE) ''PLAY AUDIO FILE RETURN TRUE ''RETURN SAYING THE BUTTON IS PUSHED ELSE IF INA[ENCODER_SEL] == 1 AND SELECT_FLAG == TRUE ''IS THE BUTTON RELEASED? AND WAS IT PUSHED BEFORE? SELECT_FLAG := FALSE ''FLAG AS BUTTON AS RELESED RETURN FALSE ''RETURN SAYING BUTTON WAS NOT PUSHED
Audio code:
CON {---------} { AUDIO } {---------} '' INTRO = 12 SEC #0, ACCEPT, ALARM, BACK, CAT, CLICK, CONFIRM, FLIPDOWN, FLIPUP, INTRO, LASER, NO, PWRDOWN, PWRUP, TURRET, YES, NULL OBJ AUDIO : "V2-WAV_DACEngine.SPIN" PRI AUDIO_START AUDIO.BEGIN(AUDIO_LEFT, AUDIO_RIGHT, SD_MOSI, SD_CLK, SD_MISO, SD_CS, SD_WP, SD_CD) PRI AUDIO_STOP AUDIO.END PRI AUDIO_PLAY(ACTION) RESULT := \AUDIO.PLAY(@@AUDIO_LIST[ACTION]) PRI AUDIO_OVERRIDE(TRUE_FALSE) AUDIO.OVERRIDESONG(TRUE_FALSE)