Skip to content

Commit 11b00e5

Browse files
authored
Add check for ESP32 devices with 26MHz crystal (#131)
1 parent a7a6482 commit 11b00e5

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

nanoFirmwareFlasher/Esp32Operations.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,46 @@ internal static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync
125125
{
126126
var revisionSuffix = "REV0";
127127
var psRamSegment = "";
128+
var otherSegment = "";
128129

129130
if (esp32Device.ChipName.Contains("revision 3"))
130131
{
131132
revisionSuffix = "REV3";
132133
}
133134

135+
if (esp32Device.Crystal.StartsWith("26"))
136+
{
137+
// this one requires the 26MHz version
138+
// and we only have a PSRAM version for this
139+
140+
// check that
141+
if (esp32Device.PSRamAvailable != PSRamAvailability.Yes)
142+
{
143+
Console.ForegroundColor = ConsoleColor.Red;
144+
145+
Console.WriteLine("");
146+
Console.WriteLine("The connected ESP32 device has a 26MHz crystal and no PSRAM.");
147+
Console.WriteLine("We currently don't have a firmware image for that combination. Please report this to the project team.");
148+
Console.WriteLine("");
149+
150+
Console.ForegroundColor = ConsoleColor.White;
151+
152+
return ExitCodes.E9000;
153+
}
154+
155+
// OK to force rev0 even if that's higher
156+
revisionSuffix = "REV0";
157+
158+
otherSegment = "_XTAL26";
159+
}
160+
134161
if (esp32Device.PSRamAvailable == PSRamAvailability.Yes)
135162
{
136163
psRamSegment = "_PSRAM";
137164
}
138165

139166
// compose target name
140-
targetName = $"ESP32{psRamSegment}_{revisionSuffix}";
167+
targetName = $"ESP32{psRamSegment}{otherSegment}_{revisionSuffix}";
141168
}
142169
}
143170
else if (esp32Device.ChipType == "ESP32-S2")

0 commit comments

Comments
 (0)