1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-02 10:53:01 +02:00

First working FreeRTOS task with static text. Send "471" every second to all outputs

This commit is contained in:
Jens Hauser
2020-07-27 21:15:53 +02:00
parent dfc6136001
commit 7e99f55739
5 changed files with 38 additions and 1 deletions

1
.gitignore vendored
View File

@@ -10,3 +10,4 @@ embedded/dist
.vscode/
.history/
*.pyc
/.vs/VSWorkspaceState.json

Binary file not shown.

Binary file not shown.

View File

@@ -5,6 +5,8 @@
uint8_t AmountOfToolChanges; // Each new tool increases this by 1. Before first tool, it<69>s 0.
float ZPosOld, ZPosNew;
static TaskHandle_t zProbeSyncTaskHandle = 0;
// return current Z machine position
float getCurrentZPos()
@@ -52,9 +54,40 @@ void machine_init()
// We start with no tool changes yet
AmountOfToolChanges=0;
ZPosOld=0;
xTaskCreatePinnedToCore(zProbeSyncTask, // task
"zProbeSyncTask", // name for task
4096, // size of task stack
NULL, // parameters
1, // priority
&zProbeSyncTaskHandle,
0 // core
);
}
#endif
void zProbeSyncTask(void* pvParameters) {
int32_t current_position[N_AXIS]; // copy of current location
float m_pos[N_AXIS]; // machine position in mm
TickType_t xLastWakeTime;
char temp[200];
const TickType_t xProbeFrequency = ZPROBE_TASK_FREQ; // in ticks (typically ms)
xLastWakeTime = xTaskGetTickCount(); // Initialise the xLastWakeTime variable with the current time.
while (true) {
// don't ever return from this or the task dies
sprintf(temp, "bla=%d\r\n", 4711);
grbl_send(CLIENT_ALL, temp);
vTaskDelayUntil(&xLastWakeTime, xProbeFrequency);
}
}
#ifdef USE_TOOL_CHANGE
/*
user_tool_change() is called when tool change gcode is received,

View File

@@ -4,6 +4,7 @@
*/
#define MACHINE_NAME "MACHINE_ESP32 Jens XYZA"
#define ZPROBE_TASK_FREQ 1000 // this is milliseconds
#ifdef N_AXIS
#undef N_AXIS
@@ -74,4 +75,6 @@
#define USE_MACHINE_INIT
#define USE_TOOL_CHANGE
#define USE_TOOL_CHANGE
void zProbeSyncTask(void* pvParameters);