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

Add support for Lolin C3 mini #620

Merged
merged 4 commits into from
Sep 19, 2022
Merged

Add support for Lolin C3 mini #620

merged 4 commits into from
Sep 19, 2022

Conversation

CheeseE
Copy link

@CheeseE CheeseE commented Sep 14, 2022

Adding support for Lolin C3 mini: link
This board is pin to pin compatible with the old D1 mini. No need to cut the enclosure when upgrading from old gateways, and because of the low power RISC-V CPU it can be still powered from EMS bus.

@@ -768,7 +768,7 @@ void EMSdevice::generate_values_web(JsonObject & output) {
if (divider > 0) {
obj["s"] = Helpers::render_value(s, (float)1 / divider, 1);
} else if (divider < 0) {
obj["s"] = Helpers::render_value(s, (-1) * divider, 0);
obj["s"] = Helpers::render_value(s, (float)(-1) * divider, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason behind adding this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's interesting because this was causing compile issues for me even without any modification. (src/emsdevice.cpp:771:78: error: call of overloaded 'render_value(char [10], int, int)' is ambiguous) I'm using the 5.1.1 version of the espriff 32 lib.

doc["min_temp"] = Helpers::render_value(min_s, 5, 0, EMSESP::system_.fahrenheit() ? 2 : 0);
doc["max_temp"] = Helpers::render_value(max_s, 30, 0, EMSESP::system_.fahrenheit() ? 2 : 0);
doc["min_temp"] = Helpers::render_value(min_s, (uint32_t)5, 0, EMSESP::system_.fahrenheit() ? 2 : 0);
doc["max_temp"] = Helpers::render_value(max_s, (uint32_t)30, 0, EMSESP::system_.fahrenheit() ? 2 : 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also what is the reason behind adding these two casts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@proddy
Copy link
Contributor

proddy commented Sep 15, 2022

looks ok, I've added a comment. @MichaelDvP do you want to review too?

Copy link
Contributor

@MichaelDvP MichaelDvP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that C3 works with little changes.
The C3 is set on compile-time, but the board-profile can changed in settings to a non-C3, Is this usefull? Also on ESP32 the C3 can be selected.
I think it's better to fix board in cpp code to C3 mini and in webcode disable selection box if C3Mini is set in program, otherwise dont add C3Mini to selection box.

@CheeseE
Copy link
Author

CheeseE commented Sep 15, 2022

Nice that C3 works with little changes. The C3 is set on compile-time, but the board-profile can changed in settings to a non-C3, Is this usefull? Also on ESP32 the C3 can be selected. I think it's better to fix board in cpp code to C3 mini and in webcode disable selection box if C3Mini is set in program, otherwise dont add C3Mini to selection box.

Hi Michael,
Thanks for the comment.
Do you know how to use compile time env vars in TS? So that I can export the board profiles list based on the board type/env type.

@MichaelDvP
Copy link
Contributor

MichaelDvP commented Sep 15, 2022

I think of something like removing C3MINI from types and modify `SettingsApplication.tsx to:

        <ValidatedTextField
          name="board_profile"
          label={LL.BOARD_PROFILE()}
          value={data.board_profile}
          disabled={processingBoard || data.board_profile === 'C3MINI'}
          variant="outlined"
          onChange={changeBoardProfile}
          margin="normal"
          select
        >
          {boardProfileSelectItems()}
          {data.board_profile === 'C3MINI' && (
            <MenuItem key={'C3MINI'} value={'C3MINI'}>
              C3 Mini
            </MenuItem>
          )}
          <Divider />
          <MenuItem key={'CUSTOM'} value={'CUSTOM'}>
            Custom&hellip;
          </MenuItem>
        </ValidatedTextField>

Than fix in cpp the board_profile to C3MINI.

But there are also other ways to check. You can simply not show the complete ValidateTextField.

@proddy
Copy link
Contributor

proddy commented Sep 15, 2022

Also @CheeseE we'll be pushing the dev branch to main soon so suggest this PR goes into the next dev build. just a FYI

@CheeseE CheeseE requested review from MichaelDvP and proddy and removed request for MichaelDvP and proddy September 15, 2022 19:34
@CheeseE CheeseE requested a review from proddy September 16, 2022 08:35
@proddy
Copy link
Contributor

proddy commented Sep 18, 2022

@CheeseE can you merge your change into the latest dev and ammend the PR?

@proddy proddy merged commit 84e7847 into emsesp:dev Sep 19, 2022
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

Successfully merging this pull request may close these issues.

3 participants