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

Terminal - Serial port tight coupling #787

Closed
zafrirron opened this issue Apr 12, 2018 · 7 comments
Closed

Terminal - Serial port tight coupling #787

zafrirron opened this issue Apr 12, 2018 · 7 comments

Comments

@zafrirron
Copy link
Contributor

For some reason there is a coupling between terminal and serial port (and in some cases debug and serial port), they should be completely separated:

It should possible not to use serial port at all (not for debug and not for terminal) and use terminal (and/or debug) thru telnet (and/or web).

@xoseperez
Copy link
Owner

Setting DEBUG_SERIAL_SUPPORT to 0 disables serial port completely (at least from the ESPurna side, other libraries might still use it) but as long as TELNET_SUPPORT and DEBUG_TELNET_SUPPORT are both set to 1 you should be able to use it via telnet.

@zafrirron
Copy link
Contributor Author

zafrirron commented Apr 12, 2018

Thanks

please see settings.ino

#ifdef DEBUG_PORT
    #define EMBEDIS_PORT    DEBUG_PORT
#else
    #define EMBEDIS_PORT    Serial
#endif

(Doing some serial stuff without DEBUG_SERIAL_SUPPORT checking)

also in system.ino

    #if DEBUG_SERIAL_SUPPORT
        DEBUG_PORT.begin(SERIAL_BAUDRATE);
        #if DEBUG_ESP_WIFI
            DEBUG_PORT.setDebugOutput(true);
        #endif
    #elif defined(SERIAL_BAUDRATE)
        Serial.begin(SERIAL_BAUDRATE);
    #endif

Serial port initializes in a way that cannot be overridden ( SERIAL_BAUDRATE initialized in general.h ), if I want to prevent any serial access or control it I need to change core code.

@xoseperez
Copy link
Owner

I see what you mean. It shouldn't be checking SERIAL_BAUDRATE. Actually the only reason to init the Serial object when DEBUG_SERIAL_SUPPORT is 0 is because some sensor or devices uses it (rfbridge for instance), and then the init should be moved to the specific code for that sensor/device.

Same thing for the default EMBEDIS_PORT value, it should be a null pointer and the StreamInjector should handle it.

@xoseperez xoseperez added this to the 1.13.0 milestone Apr 12, 2018
@xoseperez xoseperez modified the milestones: 1.13.0, 1.12.6 Apr 12, 2018
@zafrirron
Copy link
Contributor Author

Thanks
Exactly as I handled it in my private version for the exact same reasons.

@xoseperez
Copy link
Owner

OK, implementation could be improved (a terminal module?) but the basics are there. No more coupling.

@xoseperez
Copy link
Owner

@zafrirron feedback welcome

@proddy
Copy link

proddy commented Apr 22, 2018

this is handy, i was looking for a way around this. On one of my boards I'm using the Rx/Tx of UART0 to read and write values to an external serial bus (connected to my boiler) so have to rely on debug messages to telnet to see whats going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants