[PR #1628] fix(labs): use ESP32 SRAM capacity field in lab 07 #9234

Open
opened 2026-05-03 01:29:40 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1628
Author: @Shashank-Tripathi-07
Created: 5/3/2026
Status: 🔄 Open

Base: devHead: fix/lab07-esp32-sram-field


📝 Commits (1)

  • edfd8b8 fix(labs): use ESP32 SRAM capacity in lab 07

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 labs/vol1/lab_07_ml_frameworks.py (+1 -1)

📄 Description

Summary

ESP32.memory.capacity returns 8 MB flash storage (7812 KiB), not SRAM. The correct field is memory.sram_capacity (512 KiB).

In lab 07, ESP32_RAM_KB is used dynamically in:

  • The deployment target label: ESP32 ({ESP32_RAM_KB:.0f} KB) -- showed 7812 KB instead of 512 KB
  • The MathPeek block: ESP32 memory: {ESP32_RAM_KB:.0f} KB = {ESP32_RAM_KB/1024:.2f} MB and Ratio: 1800 / {ESP32_RAM_KB/1024:.2f} = {ratio:,.0f}x -- showed 7.63 MB and ~236x instead of 0.50 MB and ~3,600x

The hardcoded explanation text throughout the lab correctly states "3,600x" and "512 KB", so the wrong variable caused a visible contradiction.

Change

# Before (wrong -- reads 8 MB flash storage)
ESP32_RAM_KB = ESP32.memory.capacity.m_as("KiB")

# After (correct -- reads 512 KiB SRAM)
ESP32_RAM_KB = ESP32.memory.sram_capacity.m_as("KiB")

Same root cause as PRs #1625 (lab 01), #1626 (lab 02), #1627 (lab 03).

Test plan

  • Run lab 07 Part D, confirm deployment target label shows ESP32 (512 KB)
  • Confirm MathPeek shows 0.50 MB and ~3,600x

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1628 **Author:** [@Shashank-Tripathi-07](https://github.com/Shashank-Tripathi-07) **Created:** 5/3/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/lab07-esp32-sram-field` --- ### 📝 Commits (1) - [`edfd8b8`](https://github.com/harvard-edge/cs249r_book/commit/edfd8b8557d6e472c11b9a1353fe79781ad80971) fix(labs): use ESP32 SRAM capacity in lab 07 ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `labs/vol1/lab_07_ml_frameworks.py` (+1 -1) </details> ### 📄 Description ## Summary `ESP32.memory.capacity` returns 8 MB **flash storage** (7812 KiB), not SRAM. The correct field is `memory.sram_capacity` (512 KiB). In lab 07, `ESP32_RAM_KB` is used dynamically in: - The deployment target label: `ESP32 ({ESP32_RAM_KB:.0f} KB)` -- showed `7812 KB` instead of `512 KB` - The MathPeek block: `ESP32 memory: {ESP32_RAM_KB:.0f} KB = {ESP32_RAM_KB/1024:.2f} MB` and `Ratio: 1800 / {ESP32_RAM_KB/1024:.2f} = {ratio:,.0f}x` -- showed `7.63 MB` and `~236x` instead of `0.50 MB` and `~3,600x` The hardcoded explanation text throughout the lab correctly states "3,600x" and "512 KB", so the wrong variable caused a visible contradiction. ## Change ```python # Before (wrong -- reads 8 MB flash storage) ESP32_RAM_KB = ESP32.memory.capacity.m_as("KiB") # After (correct -- reads 512 KiB SRAM) ESP32_RAM_KB = ESP32.memory.sram_capacity.m_as("KiB") ``` Same root cause as PRs #1625 (lab 01), #1626 (lab 02), #1627 (lab 03). ## Test plan - [ ] Run lab 07 Part D, confirm deployment target label shows `ESP32 (512 KB)` - [ ] Confirm MathPeek shows `0.50 MB` and `~3,600x` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-03 01:29:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#9234