Fix CoAP test stability and runtime issues#70
Open
tfeseker wants to merge 2 commits into
Open
Conversation
Contributor
|
Hi @tfeseker, thank you very much for your pull request. @FoxyHunter7 will review your changes and merge them accordingly. |
FoxyHunter7
reviewed
May 22, 2026
Comment on lines
+17
to
+30
| CELL_APN = '' | ||
| APN_USERNAME = '' | ||
| APN_PASSWORD = '' | ||
| AUTHENTICATION_PROTOCOL = WalterModemPDPAuthProtocol.NONE | ||
| SIM_PIN = None | ||
|
|
||
| COAP_SERVER_ADDRESS = 'coap.me' | ||
| COAP_SERVER_PORT = 5683 | ||
| COAP_PATH = 'test' | ||
| COAP_PAYLOAD = '{"message":"Hello from Walter MicroPython"}' | ||
|
|
||
| COAP_CTX_ID = 0 | ||
| COAP_TIMEOUT_SECONDS = 60 | ||
| RING_WAIT_SECONDS = 20 |
Collaborator
There was a problem hiding this comment.
Suggested change
| CELL_APN = '' | |
| APN_USERNAME = '' | |
| APN_PASSWORD = '' | |
| AUTHENTICATION_PROTOCOL = WalterModemPDPAuthProtocol.NONE | |
| SIM_PIN = None | |
| COAP_SERVER_ADDRESS = 'coap.me' | |
| COAP_SERVER_PORT = 5683 | |
| COAP_PATH = 'test' | |
| COAP_PAYLOAD = '{"message":"Hello from Walter MicroPython"}' | |
| COAP_CTX_ID = 0 | |
| COAP_TIMEOUT_SECONDS = 60 | |
| RING_WAIT_SECONDS = 20 | |
| # IMPORTANT | |
| # This is an example sketch with verbose comments and logging, | |
| # in production code such verbose comments could be left out to reduce codesize. | |
| CELL_APN = '' | |
| """ | |
| The cellular Access Point Name (APN). | |
| Set to the APN provided by your network provider. | |
| Leave blank for automatic APN detection only if your provider supports it | |
| """ | |
| APN_USERNAME = '' | |
| """ | |
| The username for APN authentication. | |
| Typically, this is not required and should be left blank. | |
| Only provide a username if your network provider explicitly mandates it. | |
| """ | |
| APN_PASSWORD = '' | |
| """ | |
| The password for APN authentication. | |
| This is generally unnecessary and should remain blank. | |
| Set a password only if it is specifically required by your network provider. | |
| """ | |
| AUTHENTICATION_PROTOCOL = WalterModemPDPAuthProtocol.NONE | |
| """ | |
| The authentication protocol to use if required. | |
| Leave as none when no username/password is set. | |
| """ | |
| SIM_PIN = None | |
| """ | |
| Optional: Set this only if your SIM card requires a PIN for activation. | |
| Most IoT SIMs do not need this. | |
| """ | |
| COAP_SERVER_ADDRESS = 'coap.me' | |
| """ | |
| The address of the CoAP server. | |
| """ | |
| COAP_SERVER_PORT = 5683 | |
| """ | |
| The port of the CoAP server to use. | |
| """ | |
| COAP_PATH = 'test' | |
| """ | |
| The CoAP path on which to send. | |
| """ | |
| COAP_PAYLOAD = '{"message":"Hello from Walter MicroPython"}' | |
| """ | |
| The CoAP payload to transmit. | |
| """ | |
| COAP_CTX_ID = 0 | |
| """ | |
| The CoAP context ID to use for this connection. | |
| """ | |
| COAP_TIMEOUT_SECONDS = 60 | |
| """ | |
| Maximum time in seconds to wait for a CoAP confirmable message acknowledgement. | |
| If no ACK is received within this window the request is considered failed. | |
| """ | |
| RING_WAIT_SECONDS = 20 | |
| """ | |
| Maximum time in seconds to wait for an incoming CoAP ring (response notification) | |
| after sending a request. | |
| """ |
|
|
||
| # endregion | ||
|
|
||
| modem = Modem(CoapMixin, load_default_power_saving_mixin=False) |
Collaborator
There was a problem hiding this comment.
Suggested change
| modem = Modem(CoapMixin, load_default_power_saving_mixin=False) | |
| modem = Modem(CoapMixin, load_default_power_saving_mixin=False) | |
| """ | |
| The modem instance | |
| Loading the MQTT mixin for MQTT functionality. | |
| Loading the TLSCertsMixin to work with tls profiles. | |
| Specificying to not load the default power saving mixin, | |
| as we're not using it in this simple example. | |
| Although in most real-life scenarios it is advised to | |
| configure power-saving for reduced energy consumption | |
| """ |
| # endregion | ||
|
|
||
| modem = Modem(CoapMixin, load_default_power_saving_mixin=False) | ||
| modem_rsp = WalterModemRsp() |
Collaborator
There was a problem hiding this comment.
Suggested change
| modem_rsp = WalterModemRsp() | |
| modem_rsp = WalterModemRsp() | |
| """ | |
| The modem response object that is (re-)used | |
| when we need information from the modem. | |
| """ |
Collaborator
There was a problem hiding this comment.
Great CoAP example sketch!
However, to stay consistent with the examples sketches it would be best to add verbose comments to config variables and code functions. This to help new programmers to understand code better rather than blindly copy pasting.
I've left a few change-suggestions as examples of what I mean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I tried to run test_coap and ran into a few issues with the coap mixin. With the proposed changes, the test is successful.