Skip to content

dummy5.tc

Dummy slot 4 driver — test 5th VM autoexec without serial

Source on GitHub

// Dummy slot 4 driver — test 5th VM autoexec without serial
// Same structure as dysv17f but no serial port usage

int dummy_ok = 0;
int dummy_count = 0;
char dummy_buf[64];

void Command(char cmd[]) {
    if (strFind(cmd, "STATUS") == 0) {
        sprintf(dummy_buf, "Count: %d", dummy_count);
        responseCmnd(dummy_buf);
    } else {
        responseCmnd("Status");
    }
}

void EverySecond() {
    dummy_count++;
}

void WebCall() {
    if (dummy_ok) {
        sprintf(dummy_buf, "{s}Dummy5{m}count=%d{e}", dummy_count);
        webSend(dummy_buf);
    }
}

void JsonCall() {
    if (!dummy_ok) return;
    sprintf(dummy_buf, ",\"Dummy5\":{\"Count\":%d}", dummy_count);
    responseAppend(dummy_buf);
}

int main() {
    dummy_ok = 1;
    dummy_count = 0;
    addCommand("DUMMY5");
    print("Dummy5 driver started\n");
    return 0;
}