mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 19:02:35 +02:00
First working FreeRTOS task with static text. Send "471" every second to all outputs
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ embedded/dist
|
||||
.vscode/
|
||||
.history/
|
||||
*.pyc
|
||||
/.vs/VSWorkspaceState.json
|
||||
|
Binary file not shown.
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
@@ -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,
|
||||
|
@@ -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);
|
Reference in New Issue
Block a user