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

New feature : octoPrintSetTemperatures() #30

Open
fmatray opened this issue Jun 4, 2020 · 9 comments
Open

New feature : octoPrintSetTemperatures() #30

fmatray opened this issue Jun 4, 2020 · 9 comments

Comments

@fmatray
Copy link
Contributor

fmatray commented Jun 4, 2020

Hello,
What do you think about adding a feature et set all temperatures at once.
This can be useful to quickly set all to 0°C and cool down tools and bed.

bool octoPrintSetTemperatures(uint16_t tool0, uint16_t tool1, uint16_t bed);

@chunkysteveo
Copy link
Owner

I love the idea! I would have that function as the main function, and pass simple ones to it, like octoPrintCoolDown() ?

What could also use that function is getting the temperature presets set in the settings:

"profiles": [
{
"bed": 100,
"chamber": null,
"extruder": 230,
"name": "ABS"
},
{
"bed": 65,
"chamber": null,
"extruder": 210,
"name": "PLA"
},
{
"bed": 85,
"chamber": 0,
"extruder": 235,
"name": "PETG"
}
],

Something that would take the profile name, e.g. octoPrintSetTemperatureProfile(PETG), and that could get the profiles from settings... and apply the temperatures to your functions?

I see the profile temperatures have "chamber" in there too - is that new to the API and Octoprint?

There's some homework for you!! :)

@fmatray
Copy link
Contributor Author

fmatray commented Jun 4, 2020

Love it !!
We can do something like :
bool octoPrintSetTemperatures(uint16_t tool0 = 0, uint16_t tool1 = 0, uint16_t bed = 0);
bool octoPrintCoolDown() { return octoPrintSetTemperatures() }

For the profile definition :
#define ABS 1
#define PLA 2
#define PETG 3
struct profile_s {
unit_8_t profile_id,
uint16_t tool0;
uint16_t tool1;
uint16_t bed;
uint16_t chamber;
} profiles[] = {
{ ABS, 230, 0, 100, 0},
{ PLA, 210, 0, 65, 0},
{ PETG, 235, 0, 85, 0},
{0, 0, 0, 0}
}

I never noticed you can manage a chamber with Octoprint :-)
We only print PLA.

@chunkysteveo
Copy link
Owner

You can retrieve the profiles saved on Octoprint in the settings API endpoint. Would be nice to retrieve those profiles available. But I guess there's not much usefulness out of getting the settings from octoprint, and using the settings to send back to octoprint? Ignore me.

@fmatray
Copy link
Contributor Author

fmatray commented Jun 7, 2020

Hello,
I looked into the REST API documentation but I can't find temperatures profiles.
Do you have any idea how to retrieve the information ?

@chunkysteveo
Copy link
Owner

Yeah. They are buried deep in the settings endpoint. /api/settings you'd need to drill down the json object to get to them. Search for 'profiles' when you get all the settings back. It's a big json return, so may be too big to bring back? Try it in a browser to see the full json object.

@fmatray
Copy link
Contributor Author

fmatray commented Jun 7, 2020

It's a HUGE JSON and dependents on plugins configuration.
With mine, I get 19k characters, really TOO much for an arduino.

I tried to request just a part (temperature) but looks like it's impossible.

@chunkysteveo
Copy link
Owner

Yeah, I looked into Arduino JSON targeting just a part of a JSON object in a stream before moving it into memory. Couldn't get it to work either (getting the colour I think of the installation!). There is a streaming JSON library which does allow you to do that, but it's just not worth it right now!

Let's park the profiles for now, and just make our own locally that you can use your new setTemp functions for?

@fmatray
Copy link
Contributor Author

fmatray commented Jun 8, 2020

I agree, too complicate for the usage.

Do you code the profile part ?

@chunkysteveo
Copy link
Owner

No, not touched anything on this yet. Too busy with work.

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

2 participants