Announcement

Collapse
No announcement yet.

Compilation error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compilation error

    Hi all,
    why this gives me an error?
    What is the error claimed by workshop4?
    Thank's a lot


    //Define LOG_MESSAGES to a serial port to send SPE errors messages to. Do not use the same Serial port as SPE
    //#define LOG_MESSAGES Serial

    %%Display%%.DefineResetLine ; // *Replaced* at compile time with define for reset line connected to the display
    %%Display%%.DefineDisplaySerialx ; // *Replaced* at compile time with define the Serial Port connected to the display

    #include "NoName3Const.h"

    %%Display%%.IncludeSerial_4DLib ; // *Replaced* at compile time with an Include the Serial Library relevant to the display
    #include "%%Display%%.Processor_LedDigitsDisplay.h"
    %%Display%%.IncludeSerial_Const4D ; // *Replaced* at compile time with an Include the Constants file relevant to the display

    %%Display%%.AssignDisplaySerialtoLibrary ; // *Replaced* at compile time with an Assign of the correct Serial port to the correct library



    // routine to handle Serial errors
    void mycallback(int ErrCode, unsigned char Errorbyte)
    {
    #ifdef LOG_MESSAGES
    const char *Error4DText[] = {"OK\0", "Timeout\0", "NAK\0", "Length\0", "Invalid\0"} ;
    LOG_MESSAGES.print(F("Serial 4D Library reports error ")) ;
    LOG_MESSAGES.print(Error4DText[ErrCode]) ;
    if (ErrCode == Err4D_NAK)
    {
    LOG_MESSAGES.print(F(" returned data= ")) ;
    LOG_MESSAGES.println(Errorbyte) ;
    }
    else
    LOG_MESSAGES.println(F("")) ;
    while (1) ; // you can return here, or you can loop
    #else
    // Pin 13 has an LED connected on most Arduino boards. Just give it a name
    #define led 13
    while (1)
    {
    digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(200); // wait for a second
    digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
    delay(200); // wait for a second
    }
    #endif
    }
    // end of routine to handle Serial errors

    word hndl ;
    uint8_t state = 1;
    uint8_t numx =15;
    uint8_t on = 1;
    uint8_t frame = 78;

    void setup()
    {
    // Ucomment to use the Serial link to the PC for debugging
    // Serial.begin(115200) ; // serial to USB port
    // Note! The next statement will stop the sketch from running until the serial monitor is started
    // If it is not present the monitor will be missing the initial writes
    // while (!Serial) ; // wait for serial to be established

    pinMode(RESETLINE, OUTPUT); // Display reset pin
    %%Display%%.Toggle_Reset_On ; // *Replaced* at compile time with correct rest on logic for the attached display
    delay(100); // wait for it to be recognised
    %%Display%%.Toggle_Reset_Off ; // *Replaced* at compile time with correct rest off logic for the attached display
    // Uncomment when using ESP8266
    // pinMode(ESPRESET, OUTPUT); // ESP reset pin
    // digitalWrite(ESPRESET, 1); // Reset ESP
    // delay(100); // wait for it t
    // digitalWrite(ESPRESET, 0); // Release ESP reset
    delay(3000) ; // give display time to startup

    // now start display as Serial lines should have 'stabilised'
    %%Display%%.DisplaySerial.Begin_Speed ; // *Replaced* at compile time with command to start the serial port at the correct speed
    Display.TimeLimit4D = 5000 ; // 5 second timeout on all commands
    Display.Callback4D = mycallback ;

    // uncomment if using ESP8266
    // ESPserial.begin(115200) ; // assume esp set to 115200 baud, it's default setting
    // what we need to do is attempt to flip it to 19200
    // the maximum baud rate at which software serial actually works
    // if we run a program without resetting the ESP it will already be 19200
    // and hence the next command will not be understood or executed
    // ESPserial.println("AT+UART_CUR=19200,8,1,0,0\r\n") ;
    // ESPserial.end() ;
    // delay(10) ; // Necessary to allow for baud rate changes
    // ESPserial.begin(19200) ; // start again at a resonable baud rate
    Display.gfx_ScreenMode(LANDSCAPE) ; // change manually if orientation change
    Display.putstr("Mounting...\n");
    if (!(Display.file_Mount()))
    {
    while(!(Display.file_Mount()))
    {
    Display.putstr("Drive not mounted...");
    delay(200);
    Display.gfx_Cls();
    delay(500);
    }
    }
    //hFontn = Display.file_LoadImageControl("NoName3.dnn", "NoName3.gnn", 1); // Open handle to access uSD fonts, uncomment if required and change nn to font number
    //hstrings = Display.file_Open("NONAME~1.txf", 'r') ; // Open handle to access uSD strings, uncomment if required
    hndl = Display.file_LoadImageControl("NONAME~1.dat", "NONAME~1.gci", 1);
    // put your setup code here, to run once:

    Display.img_Show(hndl, iLeddigits1); // Leddigits1 show all digits at 0, only do this once
    Display.img_Show(hndl, iLeddigits2); // Leddigits2 show all digits at 0, only do this once
    Display.img_ClearAttributes(hndl, iWinbutton1, I_TOUCH_DISABLE); // Winbutton1 set to enable touch, only need to do this once
    Display.img_Show(hndl, iWinbutton1); // Winbutton1 show button, only do this once
    Display.img_ClearAttributes(hndl, iWinbutton2, I_TOUCH_DISABLE); // Winbutton2 set to enable touch, only need to do this once
    Display.img_Show(hndl, iWinbutton2); // Winbutton2 show button, only do this once
    Display.img_ClearAttributes(hndl, iWinbutton3, I_TOUCH_DISABLE); // Winbutton3 set to enable touch, only need to do this once
    Display.img_Show(hndl, iWinbutton3); // Winbutton3 show button, only do this once
    Display.img_Show(hndl, iLed1) ; // Led1 show initialy, if required
    Display.img_Show(hndl, iLed2) ; // Led2 show initialy, if required
    Display.img_ClearAttributes(hndl, iWinbutton4, I_TOUCH_DISABLE); // Winbutton4 set to enable touch, only need to do this once
    Display.img_Show(hndl, iWinbutton4); // Winbutton4 show button, only do this once
    } // end Setup **do not alter, remove or duplicate this line**

    void loop() {
    Display.img_Show(hndl,iStatictext3) ; // Statictext3
    LedDigitsDisplay(Display, hndl, numx, iLeddigits1+1, 32, 2, 1, 60, 0) ; // Leddigits1
    Display.img_Show(hndl,iStatictext1) ; // Statictext1
    LedDigitsDisplay(Display, hndl, numx, iLeddigits2+1, 172, 2, 1, 60, 0) ; // Leddigits2
    Display.img_Show(hndl,iStatictext2) ; // Statictext2
    Display.img_SetWord(hndl, iGauge1, IMAGE_INDEX, frame) ; // where frame is 0 to 100 (for a displayed 0 to 100)
    Display.img_Show(hndl,iGauge1) ; // Gauge1
    Display.img_SetWord(hndl, iWinbutton1, IMAGE_INDEX, state); // Winbutton1 where state is 0 for up and 1 for down
    Display.img_Show(hndl,iWinbutton1) ; // Winbutton1
    Display.img_SetWord(hndl, iWinbutton2, IMAGE_INDEX, state); // Winbutton2 where state is 0 for up and 1 for down
    Display.img_Show(hndl,iWinbutton2) ; // Winbutton2
    Display.img_SetWord(hndl, iWinbutton3, IMAGE_INDEX, state); // Winbutton3 where state is 0 for up and 1 for down
    Display.img_Show(hndl,iWinbutton3) ; // Winbutton3
    Display.img_SetWord(hndl, iLed1, IMAGE_INDEX, on) ; // where numx is 0 (Off) or 1 (On)
    Display.img_Show(hndl, iLed1) ; // Led1
    Display.img_SetWord(hndl, iLed2, IMAGE_INDEX, on) ; // where numx is 0 (Off) or 1 (On)
    Display.img_Show(hndl, iLed2) ; // Led2
    Display.img_SetWord(hndl, iWinbutton4, IMAGE_INDEX, state); // Winbutton4 where state is 0 for up and 1 for down
    Display.img_Show(hndl,iWinbutton4) ; // Winbutton4

    }





















  • #2
    Hi,

    Welcome to the forum.

    Sorry to hear you're having errors in compiling the above code. I haven't noticed anything obvious so would it be possible to send the whole project to me so I can compile it here. You can zip your project by clicking on File and then Zip Project. The code above relies on the generated constants from workshop which I will be able to generate from your project.

    Best regards

    Paul

    Comment


    • #3
      Hi Paul,
      thank's a lot. I'm happy to see this is not an evident issue so ... I'm not that bad programmer
      I'll zip the project late this evening.
      I've actually rebuilt the graphics in another project and it's all right.

      Dextop

      Comment

      Working...
      X