Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/com.cpp:586:13: error: 'gcvt' was not declared in this scope #63

Open
cbcy1234 opened this issue May 24, 2023 · 2 comments
Open

src/com.cpp:586:13: error: 'gcvt' was not declared in this scope #63

cbcy1234 opened this issue May 24, 2023 · 2 comments

Comments

@cbcy1234
Copy link

src/com.cpp:586:13: error: 'gcvt' was not declared in this scope

@darjerz
Copy link

darjerz commented Apr 10, 2024

/mnt/roboczy/cnc/offline/grbl_controller_esp32-master/grbl_controller_esp32/com.cpp:564:13: error: 'gcvt' was not declared in this scope
gcvt(savedWposXYZA[2], 3, floatToString); // convert float to string
exit status 1

Compilation error: 'gcvt' was not declared in this scope

@kangz543g
Copy link

delete gcvt(savedWposXYZA[2], 3, floatToString); // convert float to string

#include // Include necessary header for std::string
#include // Include necessary header for std::stringstream
#include // Include necessary header for std::setprecision

void sendFromString() {
char strChar;
float savedWposXYZA[4];
waitOkWhenSdMillis = millis() + WAIT_OK_SD_TIMEOUT;

while (*pPrintString != 0 && (!waitOk) && statusPrinting == PRINTING_STRING) {
    strChar = *pPrintString++;
    if (strChar == '%') {
        strChar = *pPrintString++;
        switch (strChar) {
            case 'z':
                preferences.putFloat("wposZ", wposXYZA[2]);
                break;
            case 'X':
                toGrbl(G30SavedX);
                break;
            case 'Y':
                toGrbl(G30SavedY);
                break;
            case 'Z':
                savedWposXYZA[2] = preferences.getFloat("wposZ", 0);
                {
                    std::ostringstream ss;
                    ss << std::fixed << std::setprecision(3) << savedWposXYZA[2];
                    std::string floatToString = ss.str();
                    const char* charPtr = floatToString.c_str();
                    toGrbl(charPtr);
                }
                break;
            case 'M':
                toGrbl(modalAbsRel);
                toGrbl(modalMmInch);
                break;
        }
    } else {
        if (strChar != 13 && strChar != ' ') {
            toGrbl((char)strChar);
        }
        if (strChar == '\n') {
            waitOk = true;
        }
    }
}

if (*pPrintString == 0) {
    statusPrinting = PRINTING_STOPPED;
    fillStringExecuteMsg(lastStringCmd);
    updateFullPage = true;
    toGrbl((char)0x0A);
}

}

The sketch uses 1884961 bytes (59%) of program storage space. Up to 3145728 bytes.
Global variables use 89908 bytes (27%) of dynamic memory, leaving 237772 bytes of local variables. The maximum is 327680 bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants