diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6caed02 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +*.c linguist-language=Python +*.h linguist-language=Python +*.cpp linguist-language=Python +*.hpp linguist-language=Python +*.css linguist-language=Python \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e399244 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +Data/ +ESP8266_MicroPython/ \ No newline at end of file diff --git a/Hardware/HeatPlatform.PcbDoc b/Hardware/HeatPlatform.PcbDoc new file mode 100644 index 0000000..1126362 Binary files /dev/null and b/Hardware/HeatPlatform.PcbDoc differ diff --git a/Hardware/HeatPlatform.PcbLib b/Hardware/HeatPlatform.PcbLib new file mode 100644 index 0000000..c5989bb Binary files /dev/null and b/Hardware/HeatPlatform.PcbLib differ diff --git a/Hardware/HeatPlatform.SchDoc b/Hardware/HeatPlatform.SchDoc new file mode 100644 index 0000000..0cfdab4 Binary files /dev/null and b/Hardware/HeatPlatform.SchDoc differ diff --git a/Hardware/HeatPlatform.SchLib b/Hardware/HeatPlatform.SchLib new file mode 100644 index 0000000..3c1107c Binary files /dev/null and b/Hardware/HeatPlatform.SchLib differ diff --git a/Hardware/HeatPlatform_SMT.PrjPcb b/Hardware/HeatPlatform_SMT.PrjPcb new file mode 100644 index 0000000..190020f --- /dev/null +++ b/Hardware/HeatPlatform_SMT.PrjPcb @@ -0,0 +1,1199 @@ +[Design] +Version=1.0 +HierarchyMode=0 +ChannelRoomNamingStyle=0 +ReleasesFolder= +ChannelDesignatorFormatString=$Component_$RoomName +ChannelRoomLevelSeperator=_ +OpenOutputs=1 +ArchiveProject=0 +TimestampOutput=0 +SeparateFolders=0 +TemplateLocationPath= +PinSwapBy_Netlabel=1 +PinSwapBy_Pin=1 +AllowPortNetNames=0 +AllowSheetEntryNetNames=1 +AppendSheetNumberToLocalNets=0 +NetlistSinglePinNets=0 +DefaultConfiguration=Sources +UserID=0xFFFFFFFF +DefaultPcbProtel=1 +DefaultPcbPcad=0 +ReorderDocumentsOnCompile=1 +NameNetsHierarchically=0 +PowerPortNamesTakePriority=0 +PushECOToAnnotationFile=1 +DItemRevisionGUID= +ReportSuppressedErrorsInMessages=0 +FSMCodingStyle=eFMSDropDownList_OneProcess +FSMEncodingStyle=eFMSDropDownList_OneHot +OutputPath=Project Outputs for HeatPlatform_SMT +LogFolderPath= +ManagedProjectGUID= +IncludeDesignInRelease=0 + +[Preferences] +PrefsVaultGUID= +PrefsRevisionGUID= + +[Document1] +DocumentPath=HeatPlatform.PcbLib +AnnotationEnabled=1 +AnnotateStartValue=1 +AnnotationIndexControlEnabled=0 +AnnotateSuffix= +AnnotateScope=All +AnnotateOrder=-1 +DoLibraryUpdate=1 +DoDatabaseUpdate=1 +ClassGenCCAutoEnabled=1 +ClassGenCCAutoRoomEnabled=1 +ClassGenNCAutoScope=None +DItemRevisionGUID= +GenerateClassCluster=0 +DocumentUniqueId=YDHPOGAQ + +[Document2] +DocumentPath=HeatPlatform.SchLib +AnnotationEnabled=1 +AnnotateStartValue=1 +AnnotationIndexControlEnabled=0 +AnnotateSuffix= +AnnotateScope=All +AnnotateOrder=-1 +DoLibraryUpdate=1 +DoDatabaseUpdate=1 +ClassGenCCAutoEnabled=1 +ClassGenCCAutoRoomEnabled=1 +ClassGenNCAutoScope=None +DItemRevisionGUID= +GenerateClassCluster=0 +DocumentUniqueId=ENKSQTOJ + +[Document3] +DocumentPath=HeatPlatform.SchDoc +AnnotationEnabled=1 +AnnotateStartValue=1 +AnnotationIndexControlEnabled=0 +AnnotateSuffix= +AnnotateScope=All +AnnotateOrder=0 +DoLibraryUpdate=1 +DoDatabaseUpdate=1 +ClassGenCCAutoEnabled=1 +ClassGenCCAutoRoomEnabled=1 +ClassGenNCAutoScope=None +DItemRevisionGUID= +GenerateClassCluster=0 +DocumentUniqueId=CXPBABKG + +[Document4] +DocumentPath=HeatPlatform.PcbDoc +AnnotationEnabled=1 +AnnotateStartValue=1 +AnnotationIndexControlEnabled=0 +AnnotateSuffix= +AnnotateScope=All +AnnotateOrder=-1 +DoLibraryUpdate=1 +DoDatabaseUpdate=1 +ClassGenCCAutoEnabled=1 +ClassGenCCAutoRoomEnabled=1 +ClassGenNCAutoScope=None +DItemRevisionGUID= +GenerateClassCluster=0 +DocumentUniqueId=VRXNAMEW + +[Document5] +DocumentPath=HeatPlatform_SMT.OutJob +AnnotationEnabled=1 +AnnotateStartValue=1 +AnnotationIndexControlEnabled=0 +AnnotateSuffix= +AnnotateScope=All +AnnotateOrder=-1 +DoLibraryUpdate=1 +DoDatabaseUpdate=1 +ClassGenCCAutoEnabled=1 +ClassGenCCAutoRoomEnabled=1 +ClassGenNCAutoScope=None +DItemRevisionGUID= +GenerateClassCluster=0 +DocumentUniqueId= + +[GeneratedDocument1] +DocumentPath=Project Outputs for HeatPlatform_SMT\Design Rule Check - HeatPlatform.html +DItemRevisionGUID= + +[Configuration1] +Name=Sources +ParameterCount=0 +ConstraintFileCount=0 +ReleaseItemId= +Variant=[No Variations] +OutputJobsCount=0 +ContentTypeGUID=CB6F2064-E317-11DF-B822-12313F0024A2 +ConfigurationType=Source + +[Generic_SmartPDF] +AutoOpenFile=-1 +AutoOpenOutJob=-1 + +[Generic_SmartPDFSettings] +ProjectMode=-1 +ZoomPrecision=50 +AddNetsInformation=-1 +AddNetPins=-1 +AddNetNetLabels=-1 +AddNetPorts=-1 +ShowComponentParameters=-1 +GlobalBookmarks=0 +ExportBOM=-1 +TemplateFilename=BOM Simple.XLT +TemplateStoreRelative=-1 +PCB_PrintColor=0 +SCH_PrintColor=0 +PrintQuality=-3 +SCH_ShowNoErc=-1 +SCH_ShowParameter=-1 +SCH_ShowProbes=-1 +SCH_ShowBlankets=-1 +SCH_NoERCSymbolsToShow="Thin Cross","Thick Cross","Small Cross",Checkbox,Triangle +SCH_ShowNote=-1 +SCH_ShowNoteCollapsed=-1 +SCH_ExpandLogicalToPhysical=0 +SCH_VariantName=[No Variations] +SCH_ExpandComponentDesignators=-1 +SCH_ExpandNetlabels=0 +SCH_ExpandPorts=0 +SCH_ExpandSheetNumber=0 +SCH_ExpandDocumentNumber=0 +SCH_HasExpandLogicalToPhysicalSheets=-1 +SaveSettingsToOutJob=-1 + +[Generic_EDE] +OutputDir=Project Outputs for HeatPlatform_SMT + +[OutputGroup1] +Name=Netlist Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=CadnetixNetlist +OutputName1=Cadnetix Netlist +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +OutputType2=CalayNetlist +OutputName2=Calay Netlist +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +OutputType3=EDIF +OutputName3=EDIF for PCB +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +OutputType4=EESofNetlist +OutputName4=EESof Netlist +OutputDocumentPath4= +OutputVariantName4= +OutputDefault4=0 +OutputType5=IntergraphNetlist +OutputName5=Intergraph Netlist +OutputDocumentPath5= +OutputVariantName5= +OutputDefault5=0 +OutputType6=MentorBoardStationNetlist +OutputName6=Mentor BoardStation Netlist +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +OutputType7=MultiWire +OutputName7=MultiWire +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 +OutputType8=OrCadPCB2Netlist +OutputName8=Orcad/PCB2 Netlist +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +OutputType9=PADSNetlist +OutputName9=PADS ASCII Netlist +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +OutputType10=Pcad +OutputName10=Pcad for PCB +OutputDocumentPath10= +OutputVariantName10= +OutputDefault10=0 +OutputType11=PCADNetlist +OutputName11=PCAD Netlist +OutputDocumentPath11= +OutputVariantName11= +OutputDefault11=0 +OutputType12=PCADnltNetlist +OutputName12=PCADnlt Netlist +OutputDocumentPath12= +OutputVariantName12= +OutputDefault12=0 +OutputType13=Protel2Netlist +OutputName13=Protel2 Netlist +OutputDocumentPath13= +OutputVariantName13= +OutputDefault13=0 +OutputType14=ProtelNetlist +OutputName14=Protel +OutputDocumentPath14= +OutputVariantName14= +OutputDefault14=0 +OutputType15=RacalNetlist +OutputName15=Racal Netlist +OutputDocumentPath15= +OutputVariantName15= +OutputDefault15=0 +OutputType16=RINFNetlist +OutputName16=RINF Netlist +OutputDocumentPath16= +OutputVariantName16= +OutputDefault16=0 +OutputType17=SciCardsNetlist +OutputName17=SciCards Netlist +OutputDocumentPath17= +OutputVariantName17= +OutputDefault17=0 +OutputType18=TangoNetlist +OutputName18=Tango Netlist +OutputDocumentPath18= +OutputVariantName18= +OutputDefault18=0 +OutputType19=TelesisNetlist +OutputName19=Telesis Netlist +OutputDocumentPath19= +OutputVariantName19= +OutputDefault19=0 +OutputType20=WireListNetlist +OutputName20=WireList Netlist +OutputDocumentPath20= +OutputVariantName20= +OutputDefault20=0 + +[OutputGroup2] +Name=Simulator Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 + +[OutputGroup3] +Name=Documentation Outputs +Description= +TargetPrinter=Virtual Printer +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Composite +OutputName1=Composite Drawing +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=PCB 3D Print +OutputName2=PCB 3D Print +OutputDocumentPath2= +OutputVariantName2=[No Variations] +OutputDefault2=0 +PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType3=PCB 3D Video +OutputName3=PCB 3D Video +OutputDocumentPath3= +OutputVariantName3=[No Variations] +OutputDefault3=0 +PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType4=PCB Print +OutputName4=PCB Prints +OutputDocumentPath4= +OutputVariantName4= +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType5=PCBDrawing +OutputName5=Draftsman +OutputDocumentPath5= +OutputVariantName5=[No Variations] +OutputDefault5=0 +PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType6=PCBLIB Print +OutputName6=PCBLIB Prints +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +PageOptions6=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType7=PDF3D +OutputName7=PDF3D +OutputDocumentPath7= +OutputVariantName7=[No Variations] +OutputDefault7=0 +PageOptions7=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType8=PDF3D MBA +OutputName8=PDF3D MBA +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType9=Report Print +OutputName9=Report Prints +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +PageOptions9=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType10=Schematic Print +OutputName10=Schematic Prints +OutputDocumentPath10= +OutputVariantName10= +OutputDefault10=0 +PageOptions10=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType11=SimView Print +OutputName11=SimView Prints +OutputDocumentPath11= +OutputVariantName11= +OutputDefault11=0 +PageOptions11=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 + +[OutputGroup4] +Name=Assembly Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Assembly +OutputName1=Assembly Drawings +OutputDocumentPath1= +OutputVariantName1=[No Variations] +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=Pick Place +OutputName2=Generates pick and place files +OutputDocumentPath2= +OutputVariantName2=[No Variations] +OutputDefault2=0 +OutputType3=Test Points For Assembly +OutputName3=Test Point Report +OutputDocumentPath3= +OutputVariantName3=[No Variations] +OutputDefault3=0 + +[OutputGroup5] +Name=Fabrication Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Board Stack Report +OutputName1=Report Board Stack +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=CompositeDrill +OutputName2=Composite Drill Drawing +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType3=Drill +OutputName3=Drill Drawing/Guides +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType4=Final +OutputName4=Final Artwork Prints +OutputDocumentPath4= +OutputVariantName4=[No Variations] +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType5=Gerber +OutputName5=Gerber Files +OutputDocumentPath5= +OutputVariantName5=[No Variations] +OutputDefault5=0 +OutputType6=Gerber X2 +OutputName6=Gerber X2 Files +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +OutputType7=IPC2581 +OutputName7=IPC-2581 Files +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 +OutputType8=Mask +OutputName8=Solder/Paste Mask Prints +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType9=NC Drill +OutputName9=NC Drill Files +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +OutputType10=ODB +OutputName10=ODB++ Files +OutputDocumentPath10= +OutputVariantName10=[No Variations] +OutputDefault10=0 +OutputType11=Plane +OutputName11=Power-Plane Prints +OutputDocumentPath11= +OutputVariantName11= +OutputDefault11=0 +PageOptions11=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType12=Test Points +OutputName12=Test Point Report +OutputDocumentPath12= +OutputVariantName12= +OutputDefault12=0 + +[OutputGroup6] +Name=Report Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=BOM_PartType +OutputName1=Bill of Materials +OutputDocumentPath1= +OutputVariantName1=[No Variations] +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=ComponentCrossReference +OutputName2=Component Cross Reference Report +OutputDocumentPath2= +OutputVariantName2=[No Variations] +OutputDefault2=0 +OutputType3=ReportHierarchy +OutputName3=Report Project Hierarchy +OutputDocumentPath3= +OutputVariantName3=[No Variations] +OutputDefault3=0 +OutputType4=Script +OutputName4=Script Output +OutputDocumentPath4= +OutputVariantName4=[No Variations] +OutputDefault4=0 +OutputType5=SimpleBOM +OutputName5=Simple BOM +OutputDocumentPath5= +OutputVariantName5=[No Variations] +OutputDefault5=0 +OutputType6=SinglePinNetReporter +OutputName6=Report Single Pin Nets +OutputDocumentPath6= +OutputVariantName6=[No Variations] +OutputDefault6=0 + +[OutputGroup7] +Name=Other Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Text Print +OutputName1=Text Print +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType2=Text Print +OutputName2=Text Print +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType3=Text Print +OutputName3=Text Print +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +PageOptions3=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType4=Text Print +OutputName4=Text Print +OutputDocumentPath4= +OutputVariantName4= +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType5=Text Print +OutputName5=Text Print +OutputDocumentPath5= +OutputVariantName5= +OutputDefault5=0 +PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType6=Text Print +OutputName6=Text Print +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +PageOptions6=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType7=Text Print +OutputName7=Text Print +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 +PageOptions7=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType8=Text Print +OutputName8=Text Print +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +PageOptions8=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType9=Text Print +OutputName9=Text Print +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +PageOptions9=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType10=Text Print +OutputName10=Text Print +OutputDocumentPath10= +OutputVariantName10= +OutputDefault10=0 +PageOptions10=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType11=Text Print +OutputName11=Text Print +OutputDocumentPath11= +OutputVariantName11= +OutputDefault11=0 +PageOptions11=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType12=Text Print +OutputName12=Text Print +OutputDocumentPath12= +OutputVariantName12= +OutputDefault12=0 +PageOptions12=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType13=Text Print +OutputName13=Text Print +OutputDocumentPath13= +OutputVariantName13= +OutputDefault13=0 +PageOptions13=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType14=Text Print +OutputName14=Text Print +OutputDocumentPath14= +OutputVariantName14= +OutputDefault14=0 +PageOptions14=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType15=Text Print +OutputName15=Text Print +OutputDocumentPath15= +OutputVariantName15= +OutputDefault15=0 +PageOptions15=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType16=Text Print +OutputName16=Text Print +OutputDocumentPath16= +OutputVariantName16= +OutputDefault16=0 +PageOptions16=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType17=Text Print +OutputName17=Text Print +OutputDocumentPath17= +OutputVariantName17= +OutputDefault17=0 +PageOptions17=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType18=Text Print +OutputName18=Text Print +OutputDocumentPath18= +OutputVariantName18= +OutputDefault18=0 +PageOptions18=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType19=Text Print +OutputName19=Text Print +OutputDocumentPath19= +OutputVariantName19= +OutputDefault19=0 +PageOptions19=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType20=Text Print +OutputName20=Text Print +OutputDocumentPath20= +OutputVariantName20= +OutputDefault20=0 +PageOptions20=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType21=Text Print +OutputName21=Text Print +OutputDocumentPath21= +OutputVariantName21= +OutputDefault21=0 +PageOptions21=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType22=Text Print +OutputName22=Text Print +OutputDocumentPath22= +OutputVariantName22= +OutputDefault22=0 +PageOptions22=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType23=Text Print +OutputName23=Text Print +OutputDocumentPath23= +OutputVariantName23= +OutputDefault23=0 +PageOptions23=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType24=Text Print +OutputName24=Text Print +OutputDocumentPath24= +OutputVariantName24= +OutputDefault24=0 +PageOptions24=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType25=Text Print +OutputName25=Text Print +OutputDocumentPath25= +OutputVariantName25= +OutputDefault25=0 +PageOptions25=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType26=Text Print +OutputName26=Text Print +OutputDocumentPath26= +OutputVariantName26= +OutputDefault26=0 +PageOptions26=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType27=Text Print +OutputName27=Text Print +OutputDocumentPath27= +OutputVariantName27= +OutputDefault27=0 +PageOptions27=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType28=Text Print +OutputName28=Text Print +OutputDocumentPath28= +OutputVariantName28= +OutputDefault28=0 +PageOptions28=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType29=Text Print +OutputName29=Text Print +OutputDocumentPath29= +OutputVariantName29= +OutputDefault29=0 +PageOptions29=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 + +[OutputGroup8] +Name=Validation Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=BOM_Violations +OutputName1=BOM Checks Report +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +OutputType2=Component states check +OutputName2=Server's components states check +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +OutputType3=Configuration compliance +OutputName3=Environment configuration compliance check +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +OutputType4=Design Rules Check +OutputName4=Design Rules Check +OutputDocumentPath4= +OutputVariantName4= +OutputDefault4=0 +PageOptions4=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType5=Differences Report +OutputName5=Differences Report +OutputDocumentPath5= +OutputVariantName5= +OutputDefault5=0 +PageOptions5=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType6=Electrical Rules Check +OutputName6=Electrical Rules Check +OutputDocumentPath6= +OutputVariantName6= +OutputDefault6=0 +PageOptions6=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +OutputType7=Footprint Comparison Report +OutputName7=Footprint Comparison Report +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 + +[OutputGroup9] +Name=Export Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=AutoCAD dwg/dxf PCB +OutputName1=AutoCAD dwg/dxf File PCB +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 +OutputType2=AutoCAD dwg/dxf Schematic +OutputName2=AutoCAD dwg/dxf File Schematic +OutputDocumentPath2= +OutputVariantName2= +OutputDefault2=0 +OutputType3=ExportIDF +OutputName3=Export IDF +OutputDocumentPath3= +OutputVariantName3= +OutputDefault3=0 +OutputType4=ExportPARASOLID +OutputName4=Export PARASOLID +OutputDocumentPath4= +OutputVariantName4=[No Variations] +OutputDefault4=0 +OutputType5=ExportSTEP +OutputName5=Export STEP +OutputDocumentPath5= +OutputVariantName5=[No Variations] +OutputDefault5=0 +OutputType6=ExportVRML +OutputName6=Export VRML +OutputDocumentPath6= +OutputVariantName6=[No Variations] +OutputDefault6=0 +OutputType7=MBAExportPARASOLID +OutputName7=Export PARASOLID +OutputDocumentPath7= +OutputVariantName7= +OutputDefault7=0 +OutputType8=MBAExportSTEP +OutputName8=Export STEP +OutputDocumentPath8= +OutputVariantName8= +OutputDefault8=0 +OutputType9=Save As/Export PCB +OutputName9=Save As/Export PCB +OutputDocumentPath9= +OutputVariantName9= +OutputDefault9=0 +OutputType10=Save As/Export Schematic +OutputName10=Save As/Export Schematic +OutputDocumentPath10= +OutputVariantName10= +OutputDefault10=0 +OutputType11=Specctra Design PCB +OutputName11=Specctra Design PCB +OutputDocumentPath11= +OutputVariantName11= +OutputDefault11=0 + +[OutputGroup10] +Name=PostProcess Outputs +Description= +TargetPrinter=导出为WPS PDF +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputType1=Copy Files +OutputName1=Copy Files +OutputDocumentPath1= +OutputVariantName1= +OutputDefault1=0 + +[Modification Levels] +Type1=1 +Type2=1 +Type3=1 +Type4=1 +Type5=1 +Type6=1 +Type7=1 +Type8=1 +Type9=1 +Type10=1 +Type11=1 +Type12=1 +Type13=1 +Type14=1 +Type15=1 +Type16=1 +Type17=1 +Type18=1 +Type19=1 +Type20=1 +Type21=1 +Type22=1 +Type23=1 +Type24=1 +Type25=1 +Type26=1 +Type27=1 +Type28=1 +Type29=1 +Type30=1 +Type31=1 +Type32=1 +Type33=1 +Type34=1 +Type35=1 +Type36=1 +Type37=1 +Type38=1 +Type39=1 +Type40=1 +Type41=1 +Type42=1 +Type43=1 +Type44=1 +Type45=1 +Type46=1 +Type47=1 +Type48=1 +Type49=1 +Type50=1 +Type51=1 +Type52=1 +Type53=1 +Type54=1 +Type55=1 +Type56=1 +Type57=1 +Type58=1 +Type59=1 +Type60=1 +Type61=1 +Type62=1 +Type63=1 +Type64=1 +Type65=1 +Type66=1 +Type67=1 +Type68=1 +Type69=1 +Type70=1 +Type71=1 +Type72=1 +Type73=1 +Type74=1 +Type75=1 +Type76=1 +Type77=1 +Type78=1 +Type79=1 +Type80=1 +Type81=1 +Type82=1 +Type83=1 +Type84=1 +Type85=1 +Type86=1 +Type87=1 +Type88=1 +Type89=1 +Type90=1 +Type91=1 +Type92=1 +Type93=1 +Type94=1 +Type95=1 +Type96=1 +Type97=1 +Type98=1 +Type99=1 +Type100=1 +Type101=1 +Type102=1 +Type103=1 +Type104=1 +Type105=1 +Type106=1 +Type107=1 +Type108=1 +Type109=1 +Type110=1 +Type111=1 +Type112=1 +Type113=1 +Type114=1 +Type115=1 +Type116=1 +Type117=1 +Type118=1 +Type119=1 + +[Difference Levels] +Type1=1 +Type2=1 +Type3=1 +Type4=1 +Type5=1 +Type6=1 +Type7=1 +Type8=1 +Type9=1 +Type10=1 +Type11=1 +Type12=1 +Type13=1 +Type14=1 +Type15=1 +Type16=1 +Type17=1 +Type18=1 +Type19=1 +Type20=1 +Type21=1 +Type22=1 +Type23=1 +Type24=1 +Type25=1 +Type26=1 +Type27=1 +Type28=1 +Type29=1 +Type30=1 +Type31=1 +Type32=1 +Type33=1 +Type34=1 +Type35=1 +Type36=1 +Type37=1 +Type38=1 +Type39=1 +Type40=1 +Type41=1 +Type42=1 +Type43=1 +Type44=1 +Type45=1 +Type46=1 +Type47=1 +Type48=1 +Type49=1 +Type50=1 +Type51=1 +Type52=1 +Type53=1 +Type54=1 +Type55=1 +Type56=1 +Type57=1 +Type58=1 +Type59=1 +Type60=1 +Type61=1 +Type62=1 +Type63=1 +Type64=1 +Type65=1 +Type66=1 +Type67=1 +Type68=1 + +[Electrical Rules Check] +Type1=1 +Type2=1 +Type3=2 +Type4=1 +Type5=2 +Type6=2 +Type7=0 +Type8=1 +Type9=1 +Type10=1 +Type11=2 +Type12=0 +Type13=0 +Type14=1 +Type15=1 +Type16=1 +Type17=1 +Type18=1 +Type19=1 +Type20=0 +Type21=0 +Type22=0 +Type23=0 +Type24=1 +Type25=2 +Type26=0 +Type27=2 +Type28=1 +Type29=1 +Type30=1 +Type31=1 +Type32=2 +Type33=0 +Type34=2 +Type35=1 +Type36=2 +Type37=1 +Type38=2 +Type39=2 +Type40=2 +Type41=0 +Type42=2 +Type43=1 +Type44=0 +Type45=0 +Type46=0 +Type47=0 +Type48=0 +Type49=0 +Type50=2 +Type51=0 +Type52=0 +Type53=1 +Type54=1 +Type55=1 +Type56=2 +Type57=1 +Type58=1 +Type59=2 +Type60=0 +Type61=0 +Type62=0 +Type63=0 +Type64=0 +Type65=2 +Type66=3 +Type67=2 +Type68=2 +Type69=2 +Type70=2 +Type71=2 +Type72=2 +Type73=2 +Type74=1 +Type75=2 +Type76=1 +Type77=1 +Type78=1 +Type79=1 +Type80=2 +Type81=3 +Type82=3 +Type83=3 +Type84=3 +Type85=3 +Type86=2 +Type87=2 +Type88=2 +Type89=1 +Type90=1 +Type91=3 +Type92=3 +Type93=2 +Type94=2 +Type95=2 +Type96=2 +Type97=2 +Type98=0 +Type99=1 +Type100=2 +Type101=0 +Type102=2 +Type103=2 +Type104=1 +Type105=2 +Type106=2 +Type107=2 +Type108=2 +Type109=1 +Type110=1 +Type111=1 +Type112=1 +Type113=1 +Type114=2 +Type115=2 +Type116=2 +Type117=3 +Type118=3 +Type119=3 +MultiChannelAlternate=2 +AlternateItemFail=3 +Type122=2 + +[ERC Connection Matrix] +L1=NNNNNNNNNNNWNNNWW +L2=NNWNNNNWWWNWNWNWN +L3=NWEENEEEENEWNEEWN +L4=NNENNNWEENNWNENWN +L5=NNNNNNNNNNNNNNNNN +L6=NNENNNNEENNWNENWN +L7=NNEWNNWEENNWNENWN +L8=NWEENEENEEENNEENN +L9=NWEENEEEENEWNEEWW +L10=NWNNNNNENNEWNNEWN +L11=NNENNNNEEENWNENWN +L12=WWWWNWWNWWWNWWWNN +L13=NNNNNNNNNNNWNNNWW +L14=NWEENEEEENEWNEEWW +L15=NNENNNNEEENWNENWW +L16=WWWWNWWNWWWNWWWNW +L17=WNNNNNNNWNNNWWWWN + +[Annotate] +SortOrder=3 +SortLocation=0 +ReplaceSubparts=0 +MatchParameter1=Comment +MatchStrictly1=1 +MatchParameter2=Library Reference +MatchStrictly2=1 +PhysicalNamingFormat=$Component_$RoomName +GlobalIndexSortOrder=3 +GlobalIndexSortLocation=0 + +[PrjClassGen] +CompClassManualEnabled=0 +CompClassManualRoomEnabled=0 +NetClassAutoBusEnabled=1 +NetClassAutoCompEnabled=0 +NetClassAutoNamedHarnessEnabled=0 +NetClassManualEnabled=1 +NetClassSeparateForBusSections=0 + +[LibraryUpdateOptions] +SelectedOnly=0 +UpdateVariants=1 +UpdateToLatestRevision=1 +PartTypes=0 +FullReplace=1 +UpdateDesignatorLock=1 +UpdatePartIDLock=1 +PreserveParameterLocations=1 +PreserveParameterVisibility=1 +DoGraphics=1 +DoParameters=1 +DoModels=1 +AddParameters=0 +RemoveParameters=0 +AddModels=1 +RemoveModels=1 +UpdateCurrentModels=1 + +[DatabaseUpdateOptions] +SelectedOnly=0 +UpdateVariants=1 +UpdateToLatestRevision=1 +PartTypes=0 + +[Comparison Options] +ComparisonOptions0=Kind=Net|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 +ComparisonOptions1=Kind=Net Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 +ComparisonOptions2=Kind=Component Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 +ComparisonOptions3=Kind=Rule|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 +ComparisonOptions4=Kind=Differential Pair|MinPercent=50|MinMatch=1|ShowMatch=0|Confirm=0|UseName=0|InclAllRules=0 +ComparisonOptions5=Kind=Structure Class|MinPercent=75|MinMatch=3|ShowMatch=-1|Confirm=-1|UseName=-1|InclAllRules=0 + +[SmartPDF] +PageOptions=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=1|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=A4|PaperIndex=9 +Configuration_Name1=OutputConfigurationParameter1 +Configuration_Item1=DesignatorDisplayMode=Physical|PrintArea=DesignExtent|PrintAreaLowerLeftCornerX=0|PrintAreaLowerLeftCornerY=0|PrintAreaUpperRightCornerX=0|PrintAreaUpperRightCornerY=0|Record=PcbPrintView +Configuration_Name2=OutputConfigurationParameter2 +Configuration_Item2=IncludeBoardCutouts=False|IncludeBottomLayerComponents=True|IncludeMultiLayerComponents=True|IncludeTopLayerComponents=True|IncludeViewports=True|Index=0|Mirror=False|Name=Multilayer Composite Print|PadNumberFontSize=14|Record=PcbPrintOut|ShowHoles=False|ShowPadNets=False|ShowPadNumbers=False|SubstituteFonts=False +Configuration_Name3=OutputConfigurationParameter3 +Configuration_Item3=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=TopOverlay|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name4=OutputConfigurationParameter4 +Configuration_Item4=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=TopLayer|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name5=OutputConfigurationParameter5 +Configuration_Item5=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=BottomLayer|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name6=OutputConfigurationParameter6 +Configuration_Item6=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=MultiLayer|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name7=OutputConfigurationParameter7 +Configuration_Item7=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=BottomOverlay|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name8=OutputConfigurationParameter8 +Configuration_Item8=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=KeepOutLayer|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name9=OutputConfigurationParameter9 +Configuration_Item9=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical13|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer +Configuration_Name10=OutputConfigurationParameter10 +Configuration_Item10=CArc=Full|CFill=Full|Comment=Full|Coordinate=Full|CPad=Full|CRegion=Full|CText=Full|CTrack=Full|CVia=Full|Designator=Full|Dimension=Full|DLayer1=TopLayer|DLayer2=BottomLayer|DrillType=Regular|FArc=Full|FFill=Full|FPad=Full|FRegion=Full|FText=Full|FTrack=Full|FVia=Full|Layer=Mechanical15|Polygon=Full|PrintOutIndex=0|Record=PcbPrintLayer + diff --git a/Hardware/HeatPlatform_SMT.pdf b/Hardware/HeatPlatform_SMT.pdf new file mode 100644 index 0000000..db01e46 Binary files /dev/null and b/Hardware/HeatPlatform_SMT.pdf differ diff --git a/Hardware/README.md b/Hardware/README.md new file mode 100644 index 0000000..344c28b --- /dev/null +++ b/Hardware/README.md @@ -0,0 +1,2 @@ +# PCB宸ョ▼ +姝CB宸ョ▼浣跨敤AD20缁樺埗 \ No newline at end of file diff --git a/Image/EC11_sequential.jpg b/Image/EC11_sequential.jpg new file mode 100644 index 0000000..7362f73 Binary files /dev/null and b/Image/EC11_sequential.jpg differ diff --git a/Image/HeatPlatform_Entity.jpg b/Image/HeatPlatform_Entity.jpg new file mode 100644 index 0000000..e0b0bfe Binary files /dev/null and b/Image/HeatPlatform_Entity.jpg differ diff --git a/Image/HeatPlatform_PCB.jpg b/Image/HeatPlatform_PCB.jpg new file mode 100644 index 0000000..fc04b92 Binary files /dev/null and b/Image/HeatPlatform_PCB.jpg differ diff --git a/Image/HeatPlatform_PCB_Back.jpg b/Image/HeatPlatform_PCB_Back.jpg new file mode 100644 index 0000000..b00018d Binary files /dev/null and b/Image/HeatPlatform_PCB_Back.jpg differ diff --git "a/Image/\345\215\207\346\270\25132x32.bmp" "b/Image/\345\215\207\346\270\25132x32.bmp" new file mode 100644 index 0000000..f2ddf37 Binary files /dev/null and "b/Image/\345\215\207\346\270\25132x32.bmp" differ diff --git "a/Image/\350\256\276\347\275\25616x16.bmp" "b/Image/\350\256\276\347\275\25616x16.bmp" new file mode 100644 index 0000000..2818c87 Binary files /dev/null and "b/Image/\350\256\276\347\275\25616x16.bmp" differ diff --git "a/Image/\351\224\231\350\257\25732x32.bmp" "b/Image/\351\224\231\350\257\25732x32.bmp" new file mode 100644 index 0000000..99a7171 Binary files /dev/null and "b/Image/\351\224\231\350\257\25732x32.bmp" differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md index 0f8b2a6..2d46405 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,64 @@ # HeatPlatform_SMT -DIY涓汉寤鸿鐨凷MT鍔犵儹骞冲彴 +DIY涓汉绠鏄撶殑SMT骞虫澘鍔犵儹鍙 + +Bilibli瑙嗛棰勮[閾炬帴](https://www.bilibili.com/video/BV1ky4y1m7ZF) https://www.bilibili.com/video/BV1ky4y1m7ZF + +![HeatPlatform_Entity](https://gitee.com/ClimbSnailQ/Project_Image/raw/master/Note/HeatPlatform_Entity.jpg) + +![HeatPlatform_Entity](Image/HeatPlatform_Entity.jpg) + +#### 椤圭洰璧峰洜 + +骞虫澘鍔犵儹鍙板彲浠ユ柟渚挎墜宸ュPCB杩涜璐寸墖鐒婃帴銆傛湰浜烘槸涓鍚嶅寳婕傝蒋浠跺伐绋嬪笀锛屽悓鏃朵篃鏄竴鍚嶇數瀛愮埍濂借咃紝涓轰簡鎼鏃舵柟渚匡紝宸ュ叿鐨勯夋嫨鎬绘槸鍋忓悜浜庝究鎹峰寲銆傜綉缁滀笂鎴愬搧鐨勫钩鏉垮姞鐑彴寰寰杈冧负鍘氶噸锛屾晠鑷繁鍔ㄦ墜瀹炵幇涓鍙般 + +#### 鐗硅壊 + +1. 灞忓箷浣跨敤0.96瀵哥殑OLED娑叉櫠鏄剧ず灞忥紙鍗冲皢鏀寔LCD1602锛夈 +2. 鏀寔閫氳繃wifi杩涜鍥轰欢鍗囩骇銆俒閾炬帴](ws://192.168.4.1:8266/) ws://192.168.4.1:8266/ +3. 浣跨敤鏃嬭浆缂栫爜鍣ㄤ唬鏇挎寜閿紡鎿嶄綔锛屾彁楂樼敤鎴蜂綋楠屻 +4. 鎺у埗鏉块潰鍚戜笉鍚岀敤鎴风兢浣擄紝鍒嗕负妯″潡鍖栧拰闆嗘垚鍖栦袱绉嶇數璺璁° + +## 宸ョ▼鍖呭惈 +1. 鍔犵儹骞冲彴鐨勭墿鐞嗘嫾瑁咃紝Bilibli瑙嗛[閾炬帴](https://www.bilibili.com/video/BV1ky4y1m7ZF) https://www.bilibili.com/video/BV1ky4y1m7ZF +2. 鍩轰簬ESP8266鐨勬俯鎺х郴缁 +3. 鎺ф俯绯荤粺鐨勭‖浠舵帶鍒剁數璺 + +## ESP8266娓╂帶鍣 + +![HeatPlatform_PCB](https://gitee.com/ClimbSnailQ/Project_Image/raw/master/Note/HeatPlatform_PCB.jpg) + +![HeatPlatform_PCB](Image/HeatPlatform_PCB.jpg) + +![HeatPlatform_PCB_Back](https://gitee.com/ClimbSnailQ/Project_Image/raw/master/Note/HeatPlatform_PCB_Back.jpg) + +![HeatPlatform_PCB_Back](Image/HeatPlatform_PCB_Back.jpg) + +1. 鎬讳綋浣跨敤AC220鐨勯摑鍔犵儹鏉裤 +2. 涓绘帶浣跨敤鐨勬槸ESP8266-12F銆 +3. 浣跨敤MAX6675椹卞姩鍨嬬儹鐢靛伓銆 +4. 浣跨敤PID鎺у埗绠楁硶鎺у埗鍙屽悜鍙帶纭呯殑瀵奸氱姸鎬併 +5. 浣跨敤5鑴氱殑EC11鏃嬭浆缂栫爜鍣ㄤ綔涓虹敤鎴锋搷浣滅殑鎸夐挳銆 + +#### 纭欢璁捐瑕佺偣 +1. 澶╃嚎闄勮繎瑕佷繚鎸佽冻澶熺殑鍑绌哄尯锛屽惁鍒欏奖鍝嶅ぉ绾跨殑鎬ц兘銆 +2. bootloader鍚姩鍔犺浇绋嬪簭鏃讹紝GPIO0涓轰綆鐢靛钩锛屽垯杩涘叆鍥轰欢鐑у綍妯″紡銆 +3. 姝e父鍚姩鏃讹紝GPIO0楂樸丟PIO2楂樸丟PIO15浣庛丒N楂樸丷ST楂樸 +4. GPIO16涓嶆敮鎸佷腑鏂丳WM銆両2C浠ュ強One-Wire鍔熻兘锛屽彧鑳戒綔涓烘櫘閫氱殑杈撳叆銆佽緭鍑虹鍙c +5. 鍏夎︾殑杈撳叆瑙﹀彂淇″彿鐢垫祦瑕佸ぇ浜5ma锛屼笉鐒跺厜鑰︾殑杈撳嚭绔皢涓嶈兘瀵奸氥 +6. 鍏夎︿俊鍙风殑杈撳嚭绔鎺ュ彲鎺х鐨1鑴氥 + +#### 鍦ㄧ嚎鏇存柊鍥轰欢鑴氭湰 +1. 浣跨敤webrepl杩涜鏇存柊鍥轰欢(鍙屽嚮webrepl宸ュ叿閲岀殑"webrepl.html") +2. [閾炬帴](ws://192.168.4.1:8266/) ws://192.168.4.1:8266/锛堥摼鎺ュ姞鐑帶鍒跺櫒鐨剋ifi鍚庢柟鍙摼鎺ワ級 +3. 瀵嗙爜棰勮涓篳88888888`锛堝湪config.json鏂囦欢涓凡娉ㄦ槑锛 + + +## 璧勬枡 +[PID鍔ㄧ敾婕旂ず](https://rossning92.github.io/pid-simulation/) + +## 瀛︿範璧勬枡浼犻侀棬 +1. [鏁欑▼ in Github](https://github.com/lvidarte/esp8266/wiki) +2. [ESP8266鍥轰欢](http://micropython.org/download#esp8266) +3. [uPyCraft IDE](http://docs.dfrobot.com.cn/upycraft/) +4. [瀹樻柟鍙傝冩枃妗(https://docs.micropython.org/en/latest/esp8266/quickref.html#pins-and-gpio) +5. [MicroPython API](https://makeblock-micropython-api.readthedocs.io/zh/latest/library/) \ No newline at end of file diff --git a/Software/README.md b/Software/README.md new file mode 100644 index 0000000..a544cee --- /dev/null +++ b/Software/README.md @@ -0,0 +1,57 @@ +# HeatPlatform_SMT +DIY涓汉绠鏄撶殑SMT骞虫澘鍔犵儹鍙 + +![HeatPlatform_Entity](https://gitee.com/ClimbSnailQ/Project_Image/raw/master/Note/HeatPlatform_Entity.jpg) + +![HeatPlatform_Entity](Image/HeatPlatform_Entity.jpg) + +#### 椤圭洰璧峰洜 + +骞虫澘鍔犵儹鍙板彲浠ユ柟渚挎墜宸ュPCB杩涜璐寸墖鐒婃帴銆傛湰浜烘槸涓鍚嶅寳婕傝蒋浠跺伐绋嬪笀锛屽悓鏃朵篃鏄竴鍚嶇數瀛愮埍濂借咃紝涓轰簡鎼鏃舵柟渚匡紝宸ュ叿鐨勯夋嫨鎬绘槸鍋忓悜浜庝究鎹峰寲銆傜綉缁滀笂鎴愬搧鐨勫钩鏉垮姞鐑彴寰寰杈冧负鍘氶噸锛屾晠鑷繁鍔ㄦ墜瀹炵幇涓鍙般 + +#### 鐗硅壊 + +1. 灞忓箷浣跨敤0.96瀵哥殑OLED娑叉櫠鏄剧ず灞忥紙鍗冲皢鏀寔LCD1602锛夈 +2. 鏀寔閫氳繃wifi杩涜鍥轰欢鍗囩骇銆俒閾炬帴](ws://192.168.4.1:8266/) ws://192.168.4.1:8266/ +3. 浣跨敤鏃嬭浆缂栫爜鍣ㄤ唬鏇挎寜閿紡鎿嶄綔锛屾彁楂樼敤鎴蜂綋楠屻 +4. 鎺у埗鏉块潰鍚戜笉鍚岀敤鎴风兢浣擄紝鍒嗕负妯″潡鍖栧拰闆嗘垚鍖栦袱绉嶇數璺璁° + +## 宸ョ▼鍖呭惈 +1. 鍔犵儹骞冲彴鐨勭墿鐞嗘嫾瑁咃紝Bilibli瑙嗛[閾炬帴](https://www.bilibili.com/video/BV1ky4y1m7ZF) https://www.bilibili.com/video/BV1ky4y1m7ZF +2. 鍩轰簬ESP8266鐨勬俯鎺х郴缁熴 +3. 鎺ф俯绯荤粺鐨勭‖浠舵帶鍒剁數璺 +4. 鎺у埗鍣ㄥ澹虫墦鍗版枃浠躲傦紙鏈洿鏂帮級 + +## ESP8266娓╂帶鍣 + +![HeatPlatform_PCB](https://gitee.com/ClimbSnailQ/Project_Image/raw/master/Note/HeatPlatform_PCB.png) + +![HeatPlatform_PCB](Image/HeatPlatform_PCB.png) + +1. 涓绘帶浣跨敤鐨勬槸ESP8266-12F銆 +2. 浣跨敤MAX6675椹卞姩鍨嬬儹鐢靛伓銆 +3. 浣跨敤PID鎺у埗绠楁硶鎺у埗鍙屽悜鍙帶纭呯殑瀵奸氱姸鎬併 +4. 浣跨敤5鑴氱殑EC11鏃嬭浆缂栫爜鍣ㄤ綔涓虹敤鎴锋搷浣滅殑鎸夐挳銆 + +#### 纭欢璁捐瑕佺偣 +1. 澶╃嚎闄勮繎瑕佷繚鎸佽冻澶熺殑鍑绌哄尯锛屽惁鍒欏奖鍝嶅ぉ绾跨殑鎬ц兘銆 +2. bootloader鍚姩鍔犺浇绋嬪簭鏃讹紝GPIO0涓轰綆鐢靛钩锛屽垯杩涘叆鍥轰欢鐑у綍妯″紡銆 +3. 姝e父鍚姩鏃讹紝GPIO0楂樸丟PIO2楂樸丟PIO15浣庛丒N楂樸丷ST楂樸 +4. GPIO16涓嶆敮鎸佷腑鏂丳WM銆両2C浠ュ強One-Wire鍔熻兘锛屽彧鑳戒綔涓烘櫘閫氱殑杈撳叆銆佽緭鍑虹鍙c + +#### 鍦ㄧ嚎鏇存柊鍥轰欢鑴氭湰 +1. 浣跨敤webrepl杩涜鏇存柊鍥轰欢(鍙屽嚮webrepl宸ュ叿閲岀殑"webrepl.html") +2. [閾炬帴](ws://192.168.4.1:8266/) ws://192.168.4.1:8266/锛堥摼鎺ュ姞鐑帶鍒跺櫒鐨剋ifi鍚庢柟鍙摼鎺ワ級 +3. 瀵嗙爜棰勮涓篳88888888`锛堝湪config.json鏂囦欢涓凡娉ㄦ槑锛 + + +## 璧勬枡 +[PID鍔ㄧ敾婕旂ず](https://rossning92.github.io/pid-simulation/) + +## 瀛︿範璧勬枡浼犻侀棬 +1. [鏁欑▼ in Github](https://github.com/lvidarte/esp8266/wiki) +2. [ESP8266鍥轰欢](http://micropython.org/download#esp8266) +3. [uPyCraft IDE](http://docs.dfrobot.com.cn/upycraft/) +4. [瀹樻柟鍙傝冩枃妗(https://docs.micropython.org/en/latest/esp8266/quickref.html#pins-and-gpio) +5. [MicroPython API](https://makeblock-micropython-api.readthedocs.io/zh/latest/library/) +6. [闈炲畼鏂逛腑鏂囧弬鑰冩枃妗(http://docs.dfrobot.com.cn/upycraft/3.2.2%20Pin.html) \ No newline at end of file diff --git a/Software/config.json b/Software/config.json new file mode 100644 index 0000000..976e0e1 --- /dev/null +++ b/Software/config.json @@ -0,0 +1,5 @@ +{"sta-password": "orangepi", "sta-essid": "orangepi", "ap-password": "", "ap-essid": "Heat_Platform", "webrepl-password": "88888888"} + + + + diff --git a/Software/font.py b/Software/font.py new file mode 100644 index 0000000..8f5c515 --- /dev/null +++ b/Software/font.py @@ -0,0 +1,17 @@ +bytearray(b"\x00\x80\xC0\xE0\xF8\xFF\xFE\xFC\x70\x00\x00\xC0\x80\x00\x00\x00\x00\x1F\x3F\x7F\x9F\x07\x03\xE1\xF0\xF8\xFE\xFF\xFF\x7F\x3C\x00") +bytearray(b"\x00\x00\x00\x80\xE0\xF8\xFC\x0E\x0E\xFC\xF8\xE0\x80\x00\x00\x00\x00\x38\x7E\x7F\x7F\x7F\x7F\x66\x66\x7F\x7F\x7F\x7F\x7E\x38\x00") + + +bytearray = [b'\x00\xE0\x10\x08\x08\x10\xE0\x00\x00\x0F\x10\x20\x20\x10\x0F\x00', #0 + b'\x00\x00\x10\x10\xF8\x00\x00\x00\x00\x00\x20\x20\x3F\x20\x20\x00', + b'\x00\x70\x08\x08\x08\x08\xF0\x00\x00\x30\x28\x24\x22\x21\x30\x00', + b'\x00\x30\x08\x08\x08\x88\x70\x00\x00\x18\x20\x21\x21\x22\x1C\x00', + b'\x00\x00\x80\x40\x30\xF8\x00\x00\x00\x06\x05\x24\x24\x3F\x24\x24', + b'\x00\xF8\x88\x88\x88\x08\x08\x00\x00\x19\x20\x20\x20\x11\x0E\x00', + b'\x00\xE0\x10\x88\x88\x90\x00\x00\x00\x0F\x11\x20\x20\x20\x1F\x00', + b'\x00\x18\x08\x08\x88\x68\x18\x00\x00\x00\x00\x3E\x01\x00\x00\x00', + b'\x00\x70\x88\x08\x08\x88\x70\x00\x00\x1C\x22\x21\x21\x22\x1C\x00', + b'\x00\xF0\x08\x08\x08\x10\xE0\x00\x00\x01\x12\x22\x22\x11\x0F\x00', #9 + b'\x08\x18\x68\x80\x80\x68\x18\x08\x20\x30\x2C\x03\x03\x2C\x30\x20', #X + b'\x00\x00\x00\xF8\x00\x00\x00\x00\x00\x00\x00\x33\x00\x00\x00\x00' #! + ] diff --git a/Software/knobs.py b/Software/knobs.py new file mode 100644 index 0000000..b74321d --- /dev/null +++ b/Software/knobs.py @@ -0,0 +1,116 @@ +from machine import Pin +import gc + +""" +寮鍏崇紪鐮佸櫒鍔熻兘鏂囦欢 +""" + +""" +澶栭儴涓柇mode锛 + Pin.IN 杈撳叆 + Pin.OUT 杈撳嚭 + value锛氳緭鍑虹數骞 + Pin.value锛圼value]锛変笉甯﹀弬鏁版椂鏄鍙栬緭鍏ョ數骞筹紝甯﹀弬鏁版椂鏄缃緭鍑虹數骞,鍙傛暟鏄1/0. + Pin.irq(*,trigger, handler=None) +涓柇irq鎺ュ彛 + trigger锛岃Е鍙戞柟寮(涓嶆寚瀹 榛樿涓轰笂鍗囦笅闄嶆部) + Pin.IRQ_FALLING锛屼笅闄嶆部 + Pin.IRQ_RISING锛屼笂鍗囨部 + Pin.IRQ_RISING | Pin.IRQ_FALLING锛屼笂鍗囦笅闄嶆部 + handler锛屽洖璋冨嚱鏁 +""" + + + + +class EC11: + def __init__(self, pinA_num, pinB_num, pinSw_num=None): + """ + 缂栫爜鍣ㄧ被鐨勫垵濮嬪寲 娉細鍦ㄥぇ澶氭暟鎯呭喌涓嬶紝鍙兘浣跨敤寮曡剼0銆2銆4銆5銆12銆13銆14銆15鍜16 + :param pinA_num: 鎺ユ敹缂栫爜鍣ㄨ剦鍐茬殑寮曡剼A + :param pinB_num: 鎺ユ敹缂栫爜鍣ㄨ剦鍐茬殑寮曡剼B + :param pinSw_num: 鎸夐敭瑙﹀彂鐨勫紩鑴氾紙姝や负鍙夊弬鏁帮級 + """ + self.pinA_Status = 0 + self.pinB_Status = 0 + self.pulse_count = 0 + self.switch_status = 0 + + #self.cnt_value = 0 # 缂栫爜鍣ㄨ窛绂讳笂涓杞殑鑴夊啿澧為噺 + self.pinA = Pin(pinA_num, Pin.IN, Pin.PULL_UP) + self.pinA.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=self.interruter_funcA) + self.pinB = Pin(pinB_num, Pin.IN, Pin.PULL_UP) + self.pinB.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=self.interruter_funcB) + self.pinSw = None + if pinSw_num != None: + self.pinSw = Pin(pinSw_num, Pin.IN, Pin.PULL_UP) + self.pinSw.irq(trigger=Pin.IRQ_FALLING, handler=self.interruter_funcSW) + gc.collect() + + def interruter_funcA(self, events): + """ + 鍙戠敓澶栭儴涓柇鍚庢墽琛岀殑鍑芥暟 + :return: + """ + self.pinA_Status = self.pinA.value() + if self.pinA_Status == 1 and self.pinB_Status == 0: + self.pulse_count += 1 + gc.collect() + + def interruter_funcB(self, events): + """ + 鍙戠敓澶栭儴涓柇鍚庢墽琛岀殑鍑芥暟 + :return: + """ + self.pinB_Status = self.pinB.value() + if self.pinB_Status == 1 and self.pinA_Status == 0: + self.pulse_count -= 1 + gc.collect() + + def interruter_funcSW(self, events): + """ + 鍙戠敓澶栭儴涓柇鍚庢墽琛岀殑鍑芥暟 + :return: + """ + self.switch_status = 1 + + def get_data(self): + """ + 鑾峰彇鏈妫娴嬪埌鐨勮剦鍐叉暟閲 + :return: 璺濈涓婁竴娆¤幏鍙栨墍浜х敓鐨勮剦鍐叉暟銆佹寜閿姸鎬 + """ + pulse = self.pulse_count + self.pulse_count = 0 # clear + sw_status = self.switch_status + self.switch_status = 0 # clear + gc.collect() + return pulse, sw_status + + +""" +This is demo +""" +#if __name__ == "test": +if __name__ == "__main__": + import gc + gc.collect() + knobs = EC11(4, 5, 0) + import time + while True: + print( knobs.get_data() ) + time.sleep(0.2) + + + + + + + + + + + + + + + diff --git a/Software/main.py b/Software/main.py new file mode 100644 index 0000000..23395d1 --- /dev/null +++ b/Software/main.py @@ -0,0 +1,239 @@ + + +import network +import time +from wifi import WifiController +from knobs import EC11 +from max6675 import MAX6675 +from ssd1306_esp import SSD1306_I2C +from pid import PID +import webrepl +from machine import Pin, PWM, I2C +import machine +from machine import Timer +import gc + +class Interface(): + def __init__(self, scl, sda): + i2c = I2C(scl=scl, sda=sda, freq=400000) + self.oled = SSD1306_I2C(128, 64, i2c, addr=0x3c, external_vcc=False) + self.set_draw_panel() + self.show() + + def set_draw_panel(self): + weigth = 2 + self.oled.fill_rect(0, 0, 128, weigth, 1) + self.oled.fill_rect(0, 0, weigth, 64, 1) + self.oled.fill_rect(126, 0, weigth, 64, 1) + self.oled.fill_rect(0, 62, 128, weigth, 1) + tu = b"\x00\x80\xC0\xE0\xF8\xFF\xFE\xFC\x70\x00\x00\xC0\x80\x00\x00\x00\x00\x1F\x3F\x7F\x9F\x07\x03\xE1\xF0\xF8\xFE\xFF\xFF\x7F\x3C\x00" + self.oled.img_16x16(tu, 107, 3) + tu = b"\x00\x00\x00\x80\xE0\xF8\xFC\x0E\x0E\xFC\xF8\xE0\x80\x00\x00\x00\x00\x38\x7E\x7F\x7F\x7F\x7F\x66\x66\x7F\x7F\x7F\x7F\x7E\x38\x00" + self.oled.img_16x16(tu, 107, 20) + #tu = b"\x00\x00\x00\x80\xE0\xF8\xFC\x0E\x0E\xFC\xF8\xE0\x80\x00\x00\x00\x00\x38\x7E\x7F\x7F\x7F\x7F\x66\x66\x7F\x7F\x7F\x7F\x7E\x38\x00" + #self.oled.img_16x16(tu, 118, 40) + #self.oled.fill_rect(0, 31, 96, 2, 1) + + def set_temperature_target(self, dat_str): + self.oled.text("SET: ", 3, 3) + self.oled.fill_rect(30, 3, 4*8, 8, 0) + self.oled.text(dat_str, 30, 3) + + def set_temperature_now(self, dat_str): + self.oled.fill_rect(30, 24, 4*8, 16, 0) + self.oled.text_num(dat_str, 30, 24) + + def set_pwm(self, dat_str): + self.oled.text("PWM: ", 3, 52) + self.oled.fill_rect(30, 52, len(dat_str)*8, 8, 0) + self.oled.text(dat_str, 30, 52) + + def show(self): + self.oled.show() + +class HeatPlatform(): + """ + 鍔犵儹骞冲彴鎺у埗涓荤被 + """ + def __init__(self, config_dict, LED_Status = True): + self.cfg = config_dict # 閰嶇疆鏂囦欢淇℃伅 + self.pwm_out = PWM(Pin(2), freq=5, duty=1023) + # self.pwm_out = Pin(2, Pin.OUT) + # self.pwm_out.on() + + self.max6675 = MAX6675(Pin(0), None, Pin(13), Pin(16, Pin.OUT)) + + self.temp_now = self.max6675.read_temperature() + self.temp_target = 50 + self.temp_DValue = 3 + self.pid_enable = False + gc.collect() + + # 鍒涘缓OLED鏄剧ず鍣 + # construct an I2C bus锛岃蒋浠秈2c鎵鏈夋帴鍙i兘閫傜敤 + self.LED_STATUS = LED_Status + if self.LED_STATUS == True: + self.interface = Interface(scl=Pin(1), sda=Pin(3)) + self.interface.set_temperature_now( str(self.temp_now) ) + self.interface.set_temperature_target( str(self.temp_target) ) + self.interface.show() + + + # 鍒涘缓缂栫爜鍣ㄦ帶鍒跺璞 + self.knobs = EC11(4, 5, 0) + + # 鍒涘缓pid鎺у埗瀵硅薄 + self.pid_contorller = PID(0.7, 0.4, 0.25, 0.5) + + # 鍒涘缓鎸夐敭妫娴嬬殑瀹氭椂鍣 + self.knobs_timer = Timer(-1) # periodic with 100ms period + # mode: Timer.ONE_SHOT / Timer.PERIODIC + self.knobs_timer.init(period=1000, mode=Timer.PERIODIC, callback=self.check_knobs) + + # 鍒涘缓pid璋冭妭鐨勫畾鏃跺櫒 + self.adjust_timer = Timer(-1) + # mode: Timer.ONE_SHOT / Timer.PERIODIC + self.adjust_timer.init(period=500, mode=Timer.PERIODIC, callback=self.adjust_temperature) + + gc.collect() + + def check_knobs(self, timer): + increase = self.knobs.get_data() + # increase涓轰竴涓暱搴︿负2鐨勫厓缁 缂栫爜鑴夊啿+鎸夐敭鏄惁鎸変笅 + #if increase[1] == 1: + # if self.pwm_out.value() == 1: + # self.pwm_out.off() + # else: + # self.pwm_out.on() + if increase[0] != 0: + self.temp_target = self.temp_target + increase[0] + + if self.LED_STATUS == True: + self.interface.set_temperature_target( str(self.temp_target) ) + self.interface.show() + + def adjust_temperature(self, timer): + self.temp_now = self.max6675.read_temperature() + str_temp_now = str(self.temp_now) + pwm_val = None # 杈撳嚭鐨凱WM鍊 + print("\ntemp_now = "+str_temp_now) + if self.temp_target - self.temp_now > self.temp_DValue: + pwm_val = 0 + self.pid_enable = False + elif self.temp_now > self.temp_target: + pwm_val = 1023 + self.pid_enable = False + else: + if self.pid_enable == False: + self.pid_enable = True + self.pid_contorller.clear_data() + out_val = self.pid_contorller.get_output(self.temp_target, self.temp_now) + str_out = str(out_val) + + print("str_out = "+str_out) + pwm_val = int(out_val)*100 + if pwm_val>0: + if pwm_val>1020: + pwm_val = 0 + else: + pwm_val = 1024-pwm_val + else: + pwm_val = 1023 + self.pwm_out.duty(pwm_val) + print("pwm_val = "+str(pwm_val)) + + if self.LED_STATUS == True: + if str_temp_now == "4095": + str_temp_now = "XXXX" + self.interface.set_temperature_now(str_temp_now) + self.interface.set_pwm(str(pwm_val)) + self.interface.show() + + + def __del__(self): + self.knobs_timer.deinit() + self.adjust_timer.deinit() + print("Stop HeatPlatform") + + + +class MyBoot(): + def __init__(self, config_dict): + self.cfg = config_dict # 閰嶇疆鏂囦欢淇℃伅 + webrepl.start(password = self.cfg['webrepl-password']) + # self.wifi = WifiController() + # self.connect(self.cfg) + # self.disconnect(self.cfg) + # create and configure in one go + + def disconnect(self, cfg_dict): + ret = self.wifi.get_valid_bs_list(["orangepi"]) + print(ret) + self.wifi.close_sta() + print("close_sta succ") + self.wifi.close_ap() + print("close_ap succ") + + def connect(self, cfg_dict): + ret = self.wifi.get_valid_bs_list(["orangepi"]) + print(ret) + #ret = conn.do_sta("Test", "88888888") + ret = self.wifi.do_sta(cfg_dict["sta-essid"], cfg_dict["sta-password"]) + if ret == True: + print("do_sta succ") + ret = self.wifi.create_ap (cfg_dict["ap-essid"], cfg_dict["ap-password"]) + if ret == True: + print("do_ap succ") + +def is_ADC_dress(): + from machine import ADC + adc = ADC(0) # create ADC object on ADC pin + if adc.read()<512: + return False + else: + return True + + +""" +This is demo +""" +#if __name__ == "test": +if __name__ == '__main__': + import gc + gc.collect() + import json + cfg = None + with open('config.json', 'r') as f: + cfg = json.loads(f.read()) + LED_STATUS = is_ADC_dress() + #LED_STATUS = False + print(LED_STATUS) + hp = HeatPlatform(cfg, LED_STATUS) + #boot = MyBoot(cfg) + # os.remove('wifi_config.json') # 閸掔娀娅庨弬鍥︽ + #webrepl.start(password = cfg['webrepl-password']) + while True: + time.sleep(1) + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/max6675.py b/Software/max6675.py new file mode 100644 index 0000000..37d0b3d --- /dev/null +++ b/Software/max6675.py @@ -0,0 +1,79 @@ +""" +鐑數鍋舵祴娓 +""" + +from machine import SPI, Pin +import time +import gc + +MAX6675_CONNECT = 0x04 + +# SPI API +# SPI.read(len, data=0x00) # 璇诲彇len涓暟鎹殑鍚屾椂鍐欏叆len涓猟ata鏁版嵁锛屼互鏁扮粍鐨勫舰寮忚繑鍥炶鍙栧埌鐨勬暟鎹 +# SPI.readinto(buf, data=0x00) # 璇诲彇buf.len涓暟鎹苟瀛樺叆buf涓紝鍚屾椂鍐欏叆buf.len涓猟ata鏁版嵁锛屽嚱鏁拌繑鍥濶one銆 +# SPI.write(buf) # 灏 buf 涓殑鎵鏈夋暟鎹啓鍏ュ埌鎬荤嚎銆 +# SPI.write_readinto(write_buf, read_buf) # 鍐欏叆write_buf骞惰鍙栧埌 read_buf锛屽啓鍏ュ苟璇诲彇鐨勯暱搴︿负buf闀垮害锛岃姹備袱涓紦鍐插尯闀垮害鐩稿悓銆 + +class MAX6675: + def __init__(self, sck, mosi, miso, cs): + ''' + self.spi = SPI(1, baudrate=200000, polarity=0, phase=0) + self.spi.init(baudrate=200000) # set the baudrate + # (SPI(0) 浠呯敤浜庡唴閮ㄧ殑 FlashROM銆) + ''' + self.cs = cs + self.cs.on() # 浣胯兘寮曡剼鎷夐珮self.cs = cs + self.spi = SPI(1, baudrate=100000, polarity=1, phase=0) + #self.spi = SPI(-1, baudrate=1000000, polarity=1, + # phase=0, sck=sck, mosi=mosi, miso=miso) + self.connect = False + + def read_temperature(self, ): + """ + 璇诲彇涓娆℃俯搴︼紙鎽勬皬搴︼級锛岃鍙栭敊璇垨鑰呯儹鐢靛伓寮傚父鍧囪繑鍥4095 + """ + self.cs.off() # CS寮曡剼妫娴嬪埌涓嬮檷娌垮悗鍋滄杞崲銆傞殢鍚庡湪sck鏃堕挓鎺у埗涓嬭緭鍑16浣嶆暟鎹 + value = self.spi.read(2) # 璇诲彇涓や釜瀛楄妭 + self.cs.on() + + temp = value[0]<<8|value[1] + print(value[0], value[1]) + self.connect = True if (temp & MAX6675_CONNECT) == 0 else False + gc.collect() + if self.connect == True: # 娌℃娴嬪埌鐢电儹鍋 + return ((temp&0x7FFF)>>3)>>2 # 娴嬪緱鐨勬俯搴﹀崟浣嶆槸0.25锛屾墍浠ヨ涔樹互0.25锛堝嵆闄や互4锛 + else: + return 4095 + + + def __del__(self, ): + self.spi.deinit() # 鍏抽棴spi + + +""" +This is demo +""" +#if __name__ == "test": +if __name__ == "__main__": + import gc + gc.collect() + max6675 = MAX6675(Pin(0), Pin(2), Pin(13), Pin(16, Pin.OUT)) + while True: + val = max6675.read_temperature() + print(val) + time.sleep(1) + + + + + + + + + + + + + + + diff --git a/Software/microWebSocket.py b/Software/microWebSocket.py new file mode 100644 index 0000000..e512bac --- /dev/null +++ b/Software/microWebSocket.py @@ -0,0 +1,284 @@ +""" +The MIT License (MIT) +Copyright 婕 2018 Jean-Christophe Bos & HC铏 (www.hc2.fr) +""" + +from hashlib import sha1 +from binascii import b2a_base64 +from struct import pack +from _thread import start_new_thread, allocate_lock +import gc + +class MicroWebSocket : + + # ============================================================================ + # ===( Constants )============================================================ + # ============================================================================ + + _handshakeSign = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" + + _opContFrame = 0x0 + _opTextFrame = 0x1 + _opBinFrame = 0x2 + _opCloseFrame = 0x8 + _opPingFrame = 0x9 + _opPongFrame = 0xA + + _msgTypeText = 1 + _msgTypeBin = 2 + + # ============================================================================ + # ===( Utils )=============================================================== + # ============================================================================ + + @staticmethod + def _tryAllocByteArray(size) : + for x in range(10) : + try : + gc.collect() + return bytearray(size) + except : + pass + return None + + # ---------------------------------------------------------------------------- + + @staticmethod + def _tryStartThread(func, args=()) : + for x in range(10) : + try : + gc.collect() + start_new_thread(func, args) + return True + except : + global _mws_thread_id + try : + _mws_thread_id += 1 + except : + _mws_thread_id = 0 + try : + start_new_thread('MWS_THREAD_%s' % _mws_thread_id, func, args) + return True + except : + pass + return False + + # ============================================================================ + # ===( Constructor )========================================================== + # ============================================================================ + + def __init__(self, socket, httpClient, httpResponse, maxRecvLen, threaded, acceptCallback) : + self._socket = socket + self._httpCli = httpClient + self._closed = True + self._lock = allocate_lock() + self.RecvTextCallback = None + self.RecvBinaryCallback = None + self.ClosedCallback = None + + if hasattr(socket, 'read'): # MicroPython + self._socketfile = self._socket + else: # CPython + self._socketfile = self._socket.makefile('rwb') + + if self._handshake(httpResponse) : + self._ctrlBuf = MicroWebSocket._tryAllocByteArray(0x7D) + self._msgBuf = MicroWebSocket._tryAllocByteArray(maxRecvLen) + if self._ctrlBuf and self._msgBuf : + self._msgType = None + self._msgLen = 0 + if threaded : + if MicroWebSocket._tryStartThread(self._wsProcess, (acceptCallback, )) : + return + else : + self._wsProcess(acceptCallback) + return + print("MicroWebSocket : Out of memory on new WebSocket connection.") + try : + if self._socketfile is not self._socket: + self._socketfile.close() + self._socket.close() + except : + pass + + # ============================================================================ + # ===( Functions )============================================================ + # ============================================================================ + + def _handshake(self, httpResponse) : + try : + key = self._httpCli.GetRequestHeaders().get('sec-websocket-key', None) + if key : + key += self._handshakeSign + r = sha1(key.encode()).digest() + r = b2a_base64(r).decode().strip() + httpResponse.WriteSwitchProto("websocket", { "Sec-WebSocket-Accept" : r }) + return True + except : + pass + return False + + # ---------------------------------------------------------------------------- + + def _wsProcess(self, acceptCallback) : + self._socket.settimeout(3600) + self._closed = False + try : + acceptCallback(self, self._httpCli) + except Exception as ex : + print("MicroWebSocket : Error on accept callback (%s)." % str(ex)) + while not self._closed : + if not self._receiveFrame() : + self.Close() + if self.ClosedCallback : + try : + self.ClosedCallback(self) + except Exception as ex : + print("MicroWebSocket : Error on closed callback (%s)." % str(ex)) + + # ---------------------------------------------------------------------------- + + def _receiveFrame(self) : + try : + b = self._socketfile.read(2) + if not b or len(b) != 2 : + return False + + fin = b[0] & 0x80 > 0 + opcode = b[0] & 0x0F + masked = b[1] & 0x80 > 0 + length = b[1] & 0x7F + + if opcode == self._opContFrame and not self._msgType : + return False + elif opcode == self._opTextFrame : + self._msgType = self._msgTypeText + elif opcode == self._opBinFrame : + self._msgType = self._msgTypeBin + + if length == 0x7E : + b = self._socketfile.read(2) + if not b or len(b) != 2 : + return False + length = (b[0] << 8) + b[1] + elif length == 0x7F : + return False + + mask = self._socketfile.read(4) if masked else None + if masked and (not mask or len(mask) != 4) : + return False + + if opcode == self._opContFrame or \ + opcode == self._opTextFrame or \ + opcode == self._opBinFrame : + + if length > 0 : + buf = memoryview(self._msgBuf)[self._msgLen:] + if length > len(buf) : + return False + x = self._socketfile.readinto(buf[0:length]) + if x != length : + return False + if masked : + for i in range(length) : + idx = self._msgLen + i + self._msgBuf[idx] ^= mask[i%4] + self._msgLen += length + if fin : + b = bytes(memoryview(self._msgBuf)[:self._msgLen]) + if self._msgType == self._msgTypeText : + if self.RecvTextCallback : + try : + self.RecvTextCallback(self, b.decode()) + except Exception as ex : + print("MicroWebSocket : Error on recv text callback (%s)." % str(ex)) + else : + if self.RecvBinaryCallback : + try : + self.RecvBinaryCallback(self, b) + except Exception as ex : + print("MicroWebSocket : Error on recv binary callback (%s)." % str(ex)) + self._msgType = None + self._msgLen = 0 + else : + return False + + elif opcode == self._opPingFrame : + + if length > len(self._ctrlBuf) : + return False + if length > 0 : + x = self._socketfile.readinto(self._ctrlBuf[0:length]) + if x != length : + return False + pingData = memoryview(self._ctrlBuf)[:length] + else : + pingData = None + self._sendFrame(self._opPongFrame, pingData) + + elif opcode == self._opCloseFrame : + self.Close() + + except : + return False + + return True + + # ---------------------------------------------------------------------------- + + def _sendFrame(self, opcode, data=None, fin=True) : + if not self._closed and opcode >= 0x00 and opcode <= 0x0F : + dataLen = 0 if not data else len(data) + if dataLen <= 0xFFFF : + b1 = (0x80 | opcode) if fin else opcode + b2 = 0x7E if dataLen >= 0x7E else dataLen + self._lock.acquire() + try : + if self._socketfile.write(pack('>BB', b1, b2)) == 2 : + if dataLen > 0 : + if dataLen >= 0x7E : + self._socketfile.write(pack('>H', dataLen)) + ret = self._socketfile.write(data) == dataLen + else : + ret = True + if self._socketfile is not self._socket : + self._socketfile.flush() # CPython needs flush to continue protocol + self._lock.release() + return ret + except : + pass + self._lock.release() + return False + + # ---------------------------------------------------------------------------- + + def SendText(self, msg) : + return self._sendFrame(self._opTextFrame, msg.encode()) + + # ---------------------------------------------------------------------------- + + def SendBinary(self, data) : + return self._sendFrame(self._opBinFrame, data) + + # ---------------------------------------------------------------------------- + + def IsClosed(self) : + return self._closed + + # ---------------------------------------------------------------------------- + + def Close(self) : + if not self._closed : + try : + self._sendFrame(self._opCloseFrame) + if self._socketfile is not self._socket: + self._socketfile.close() + self._socket.close() + self._closed = True + except : + pass + + # ============================================================================ + # ============================================================================ + # ============================================================================ + diff --git a/Software/microWebSrv.py b/Software/microWebSrv.py new file mode 100644 index 0000000..d9ab5ff --- /dev/null +++ b/Software/microWebSrv.py @@ -0,0 +1,863 @@ +""" +The MIT License (MIT) +Copyright 婕 2018 Jean-Christophe Bos & HC铏 (www.hc2.fr) +""" + + +from json import loads, dumps +from os import stat +from _thread import start_new_thread +import socket +import gc +import re + +try : + from microWebTemplate import MicroWebTemplate +except : + pass + +try : + from microWebSocket import MicroWebSocket +except : + pass + +class MicroWebSrvRoute : + def __init__(self, route, method, func, routeArgNames, routeRegex) : + self.route = route + self.method = method + self.func = func + self.routeArgNames = routeArgNames + self.routeRegex = routeRegex + + +class MicroWebSrv : + + # ============================================================================ + # ===( Constants )============================================================ + # ============================================================================ + + _indexPages = [ + "index.pyhtml", + "index.html", + "index.htm", + "default.pyhtml", + "default.html", + "default.htm" + ] + + _mimeTypes = { + ".txt" : "text/plain", + ".htm" : "text/html", + ".html" : "text/html", + ".css" : "text/css", + ".csv" : "text/csv", + ".js" : "application/javascript", + ".xml" : "application/xml", + ".xhtml" : "application/xhtml+xml", + ".json" : "application/json", + ".zip" : "application/zip", + ".pdf" : "application/pdf", + ".jpg" : "image/jpeg", + ".jpeg" : "image/jpeg", + ".png" : "image/png", + ".gif" : "image/gif", + ".svg" : "image/svg+xml", + ".ico" : "image/x-icon" + } + + _html_escape_chars = { + "&" : "&", + '"' : """, + "'" : "'", + ">" : ">", + "<" : "<" + } + + _pyhtmlPagesExt = '.pyhtml' + + # ============================================================================ + # ===( Class globals )======================================================= + # ============================================================================ + + _docoratedRouteHandlers = [] + + # ============================================================================ + # ===( Utils )=============================================================== + # ============================================================================ + + @classmethod + def route(cls, url, method='GET'): + """ Adds a route handler function to the routing list """ + def route_decorator(func): + item = (url, method, func) + cls._docoratedRouteHandlers.append(item) + return func + return route_decorator + + # ---------------------------------------------------------------------------- + + @staticmethod + def HTMLEscape(s) : + return ''.join(MicroWebSrv._html_escape_chars.get(c, c) for c in s) + + # ---------------------------------------------------------------------------- + + @staticmethod + def _startThread(func, args=()) : + try : + start_new_thread(func, args) + except : + global _mwsrv_thread_id + try : + _mwsrv_thread_id += 1 + except : + _mwsrv_thread_id = 0 + try : + start_new_thread('MWSRV_THREAD_%s' % _mwsrv_thread_id, func, args) + except : + return False + return True + + # ---------------------------------------------------------------------------- + + @staticmethod + def _unquote(s) : + r = s.split('%') + for i in range(1, len(r)) : + s = r[i] + try : + r[i] = chr(int(s[:2], 16)) + s[2:] + except : + r[i] = '%' + s + return ''.join(r) + + # ------------------------------------------------------------------------------ + + @staticmethod + def _unquote_plus(s) : + return MicroWebSrv._unquote(s.replace('+', ' ')) + + # ------------------------------------------------------------------------------ + + @staticmethod + def _fileExists(path) : + try : + stat(path) + return True + except : + return False + + # ---------------------------------------------------------------------------- + + @staticmethod + def _isPyHTMLFile(filename) : + return filename.lower().endswith(MicroWebSrv._pyhtmlPagesExt) + + # ============================================================================ + # ===( Constructor )========================================================== + # ============================================================================ + + def __init__( self, + routeHandlers = [], + port = 80, + bindIP = '0.0.0.0', + webPath = "/flash/www" ) : + + self._srvAddr = (bindIP, port) + self._webPath = webPath + self._notFoundUrl = None + self._started = False + + self.MaxWebSocketRecvLen = 1024 + self.WebSocketThreaded = True + self.AcceptWebSocketCallback = None + self.LetCacheStaticContentLevel = 2 + + self._routeHandlers = [] + routeHandlers += self._docoratedRouteHandlers + for route, method, func in routeHandlers : + routeParts = route.split('/') + # -> ['', 'users', '', 'addresses', '', 'test', ''] + routeArgNames = [] + routeRegex = '' + for s in routeParts : + if s.startswith('<') and s.endswith('>') : + routeArgNames.append(s[1:-1]) + routeRegex += '/(\\w*)' + elif s : + routeRegex += '/' + s + routeRegex += '$' + # -> '/users/(\w*)/addresses/(\w*)/test/(\w*)$' + routeRegex = re.compile(routeRegex) + + self._routeHandlers.append(MicroWebSrvRoute(route, method, func, routeArgNames, routeRegex)) + + # ============================================================================ + # ===( Server Process )======================================================= + # ============================================================================ + + def _serverProcess(self) : + self._started = True + while True : + try : + client, cliAddr = self._server.accept() + except Exception as ex : + if ex.args and ex.args[0] == 113 : + break + continue + self._client(self, client, cliAddr) + self._started = False + + # ============================================================================ + # ===( Functions )============================================================ + # ============================================================================ + + def Start(self, threaded=False) : + if not self._started : + self._server = socket.socket( socket.AF_INET, + socket.SOCK_STREAM, + socket.IPPROTO_TCP ) + self._server.setsockopt( socket.SOL_SOCKET, + socket.SO_REUSEADDR, + 1 ) + self._server.bind(self._srvAddr) + self._server.listen(1) + if threaded : + MicroWebSrv._startThread(self._serverProcess) + else : + self._serverProcess() + + # ---------------------------------------------------------------------------- + + def Stop(self) : + if self._started : + self._server.close() + + # ---------------------------------------------------------------------------- + + def IsStarted(self) : + return self._started + + # ---------------------------------------------------------------------------- + + def SetNotFoundPageUrl(self, url=None) : + self._notFoundUrl = url + + # ---------------------------------------------------------------------------- + + def GetMimeTypeFromFilename(self, filename) : + filename = filename.lower() + for ext in self._mimeTypes : + if filename.endswith(ext) : + return self._mimeTypes[ext] + return None + + # ---------------------------------------------------------------------------- + + def GetRouteHandler(self, resUrl, method) : + if self._routeHandlers : + #resUrl = resUrl.upper() + if resUrl.endswith('/') : + resUrl = resUrl[:-1] + method = method.upper() + for rh in self._routeHandlers : + if rh.method == method : + m = rh.routeRegex.match(resUrl) + if m : # found matching route? + if rh.routeArgNames : + routeArgs = {} + for i, name in enumerate(rh.routeArgNames) : + value = m.group(i+1) + try : + value = int(value) + except : + pass + routeArgs[name] = value + return (rh.func, routeArgs) + else : + return (rh.func, None) + return (None, None) + + # ---------------------------------------------------------------------------- + + def _physPathFromURLPath(self, urlPath) : + if urlPath == '/' : + for idxPage in self._indexPages : + physPath = self._webPath + '/' + idxPage + if MicroWebSrv._fileExists(physPath) : + return physPath + else : + physPath = self._webPath + urlPath + if MicroWebSrv._fileExists(physPath) : + return physPath + return None + + # ============================================================================ + # ===( Class Client )======================================================== + # ============================================================================ + + class _client : + + # ------------------------------------------------------------------------ + + def __init__(self, microWebSrv, socket, addr) : + socket.settimeout(2) + self._microWebSrv = microWebSrv + self._socket = socket + self._addr = addr + self._method = None + self._path = None + self._httpVer = None + self._resPath = "/" + self._queryString = "" + self._queryParams = { } + self._headers = { } + self._contentType = None + self._contentLength = 0 + + if hasattr(socket, 'readline'): # MicroPython + self._socketfile = self._socket + else: # CPython + self._socketfile = self._socket.makefile('rwb') + + self._processRequest() + + # ------------------------------------------------------------------------ + + def _processRequest(self) : + try : + response = MicroWebSrv._response(self) + if self._parseFirstLine(response) : + if self._parseHeader(response) : + upg = self._getConnUpgrade() + if not upg : + routeHandler, routeArgs = self._microWebSrv.GetRouteHandler(self._resPath, self._method) + if routeHandler : + if routeArgs is not None: + routeHandler(self, response, routeArgs) + else: + routeHandler(self, response) + elif self._method.upper() == "GET" : + filepath = self._microWebSrv._physPathFromURLPath(self._resPath) + if filepath : + if MicroWebSrv._isPyHTMLFile(filepath) : + response.WriteResponsePyHTMLFile(filepath) + else : + contentType = self._microWebSrv.GetMimeTypeFromFilename(filepath) + if contentType : + if self._microWebSrv.LetCacheStaticContentLevel > 0 : + if self._microWebSrv.LetCacheStaticContentLevel > 1 and \ + 'if-modified-since' in self._headers : + response.WriteResponseNotModified() + else: + headers = { 'Last-Modified' : 'Fri, 1 Jan 2018 23:42:00 GMT', \ + 'Cache-Control' : 'max-age=315360000' } + response.WriteResponseFile(filepath, contentType, headers) + else : + response.WriteResponseFile(filepath, contentType) + else : + response.WriteResponseForbidden() + else : + response.WriteResponseNotFound() + else : + response.WriteResponseMethodNotAllowed() + elif upg == 'websocket' and 'MicroWebSocket' in globals() \ + and self._microWebSrv.AcceptWebSocketCallback : + MicroWebSocket( socket = self._socket, + httpClient = self, + httpResponse = response, + maxRecvLen = self._microWebSrv.MaxWebSocketRecvLen, + threaded = self._microWebSrv.WebSocketThreaded, + acceptCallback = self._microWebSrv.AcceptWebSocketCallback ) + return + else : + response.WriteResponseNotImplemented() + else : + response.WriteResponseBadRequest() + except : + response.WriteResponseInternalServerError() + try : + if self._socketfile is not self._socket: + self._socketfile.close() + self._socket.close() + except : + pass + + # ------------------------------------------------------------------------ + + def _parseFirstLine(self, response) : + try : + elements = self._socketfile.readline().decode().strip().split() + if len(elements) == 3 : + self._method = elements[0].upper() + self._path = elements[1] + self._httpVer = elements[2].upper() + elements = self._path.split('?', 1) + if len(elements) > 0 : + self._resPath = MicroWebSrv._unquote_plus(elements[0]) + if len(elements) > 1 : + self._queryString = elements[1] + elements = self._queryString.split('&') + for s in elements : + param = s.split('=', 1) + if len(param) > 0 : + value = MicroWebSrv._unquote(param[1]) if len(param) > 1 else '' + self._queryParams[MicroWebSrv._unquote(param[0])] = value + return True + except : + pass + return False + + # ------------------------------------------------------------------------ + + def _parseHeader(self, response) : + while True : + elements = self._socketfile.readline().decode().strip().split(':', 1) + if len(elements) == 2 : + self._headers[elements[0].strip().lower()] = elements[1].strip() + elif len(elements) == 1 and len(elements[0]) == 0 : + if self._method == 'POST' or self._method == 'PUT' : + self._contentType = self._headers.get("content-type", None) + self._contentLength = int(self._headers.get("content-length", 0)) + return True + else : + return False + + # ------------------------------------------------------------------------ + + def _getConnUpgrade(self) : + if 'upgrade' in self._headers.get('connection', '').lower() : + return self._headers.get('upgrade', '').lower() + return None + + # ------------------------------------------------------------------------ + + def GetServer(self) : + return self._microWebSrv + + # ------------------------------------------------------------------------ + + def GetAddr(self) : + return self._addr + + # ------------------------------------------------------------------------ + + def GetIPAddr(self) : + return self._addr[0] + + # ------------------------------------------------------------------------ + + def GetPort(self) : + return self._addr[1] + + # ------------------------------------------------------------------------ + + def GetRequestMethod(self) : + return self._method + + # ------------------------------------------------------------------------ + + def GetRequestTotalPath(self) : + return self._path + + # ------------------------------------------------------------------------ + + def GetRequestPath(self) : + return self._resPath + + # ------------------------------------------------------------------------ + + def GetRequestQueryString(self) : + return self._queryString + + # ------------------------------------------------------------------------ + + def GetRequestQueryParams(self) : + return self._queryParams + + # ------------------------------------------------------------------------ + + def GetRequestHeaders(self) : + return self._headers + + # ------------------------------------------------------------------------ + + def GetRequestContentType(self) : + return self._contentType + + # ------------------------------------------------------------------------ + + def GetRequestContentLength(self) : + return self._contentLength + + # ------------------------------------------------------------------------ + + def ReadRequestContent(self, size=None) : + self._socket.setblocking(False) + b = None + try : + if not size : + b = self._socketfile.read(self._contentLength) + elif size > 0 : + b = self._socketfile.read(size) + except : + pass + self._socket.setblocking(True) + return b if b else b'' + + # ------------------------------------------------------------------------ + + def ReadRequestPostedFormData(self) : + res = { } + data = self.ReadRequestContent() + if len(data) > 0 : + elements = data.decode().split('&') + for s in elements : + param = s.split('=', 1) + if len(param) > 0 : + value = MicroWebSrv._unquote(param[1]) if len(param) > 1 else '' + res[MicroWebSrv._unquote(param[0])] = value + return res + + # ------------------------------------------------------------------------ + + def ReadRequestContentAsJSON(self) : + try : + return loads(self.ReadRequestContent()) + except : + return None + + # ============================================================================ + # ===( Class Response )====================================================== + # ============================================================================ + + class _response : + + # ------------------------------------------------------------------------ + + def __init__(self, client) : + self._client = client + + # ------------------------------------------------------------------------ + + def _write(self, data) : + if data : + if type(data) == str : + data = data.encode() + return self._client._socketfile.write(data) + return 0 + + # ------------------------------------------------------------------------ + + def _writeFirstLine(self, code) : + reason = self._responseCodes.get(code, ('Unknown reason', ))[0] + self._write("HTTP/1.1 %s %s\r\n" % (code, reason)) + + # ------------------------------------------------------------------------ + + def _writeHeader(self, name, value) : + self._write("%s: %s\r\n" % (name, value)) + + # ------------------------------------------------------------------------ + + def _writeContentTypeHeader(self, contentType, charset=None) : + if contentType : + ct = contentType \ + + (("; charset=%s" % charset) if charset else "") + else : + ct = "application/octet-stream" + self._writeHeader("Content-Type", ct) + + # ------------------------------------------------------------------------ + + def _writeServerHeader(self) : + self._writeHeader("Server", "MicroWebSrv by JC`zic") + + # ------------------------------------------------------------------------ + + def _writeEndHeader(self) : + self._write("\r\n") + + # ------------------------------------------------------------------------ + + def _writeBeforeContent(self, code, headers, contentType, contentCharset, contentLength) : + self._writeFirstLine(code) + if isinstance(headers, dict) : + for header in headers : + self._writeHeader(header, headers[header]) + if contentLength > 0 : + self._writeContentTypeHeader(contentType, contentCharset) + self._writeHeader("Content-Length", contentLength) + self._writeServerHeader() + self._writeHeader("Connection", "close") + self._writeEndHeader() + + # ------------------------------------------------------------------------ + + def WriteSwitchProto(self, upgrade, headers=None) : + self._writeFirstLine(101) + self._writeHeader("Connection", "Upgrade") + self._writeHeader("Upgrade", upgrade) + if isinstance(headers, dict) : + for header in headers : + self._writeHeader(header, headers[header]) + self._writeServerHeader() + self._writeEndHeader() + if self._client._socketfile is not self._client._socket : + self._client._socketfile.flush() # CPython needs flush to continue protocol + + # ------------------------------------------------------------------------ + + def WriteResponse(self, code, headers, contentType, contentCharset, content) : + try : + if content : + if type(content) == str : + content = content.encode() + contentLength = len(content) + else : + contentLength = 0 + self._writeBeforeContent(code, headers, contentType, contentCharset, contentLength) + if content : + self._write(content) + return True + except : + return False + + # ------------------------------------------------------------------------ + + def WriteResponsePyHTMLFile(self, filepath, headers=None, vars=None) : + if 'MicroWebTemplate' in globals() : + with open(filepath, 'r') as file : + code = file.read() + mWebTmpl = MicroWebTemplate(code, escapeStrFunc=MicroWebSrv.HTMLEscape, filepath=filepath) + try : + tmplResult = mWebTmpl.Execute(None, vars) + return self.WriteResponse(200, headers, "text/html", "UTF-8", tmplResult) + except Exception as ex : + return self.WriteResponse( 500, + None, + "text/html", + "UTF-8", + self._execErrCtnTmpl % { + 'module' : 'PyHTML', + 'message' : str(ex) + } ) + return self.WriteResponseNotImplemented() + + # ------------------------------------------------------------------------ + + def WriteResponseFile(self, filepath, contentType=None, headers=None) : + try : + size = stat(filepath)[6] + if size > 0 : + with open(filepath, 'rb') as file : + self._writeBeforeContent(200, headers, contentType, None, size) + try : + buf = bytearray(1024) + while size > 0 : + x = file.readinto(buf) + if x < len(buf) : + buf = memoryview(buf)[:x] + self._write(buf) + size -= x + return True + except : + self.WriteResponseInternalServerError() + return False + except : + pass + self.WriteResponseNotFound() + return False + + # ------------------------------------------------------------------------ + + def WriteResponseFileAttachment(self, filepath, attachmentName, headers=None) : + if not isinstance(headers, dict) : + headers = { } + headers["Content-Disposition"] = "attachment; filename=\"%s\"" % attachmentName + return self.WriteResponseFile(filepath, None, headers) + + # ------------------------------------------------------------------------ + + def WriteResponseOk(self, headers=None, contentType=None, contentCharset=None, content=None) : + return self.WriteResponse(200, headers, contentType, contentCharset, content) + + # ------------------------------------------------------------------------ + + def WriteResponseJSONOk(self, obj=None, headers=None) : + return self.WriteResponse(200, headers, "application/json", "UTF-8", dumps(obj)) + + # ------------------------------------------------------------------------ + + def WriteResponseRedirect(self, location) : + headers = { "Location" : location } + return self.WriteResponse(302, headers, None, None, None) + + # ------------------------------------------------------------------------ + + def WriteResponseError(self, code) : + responseCode = self._responseCodes.get(code, ('Unknown reason', '')) + return self.WriteResponse( code, + None, + "text/html", + "UTF-8", + self._errCtnTmpl % { + 'code' : code, + 'reason' : responseCode[0], + 'message' : responseCode[1] + } ) + + # ------------------------------------------------------------------------ + + def WriteResponseJSONError(self, code, obj=None) : + return self.WriteResponse( code, + None, + "application/json", + "UTF-8", + dumps(obj if obj else { }) ) + + # ------------------------------------------------------------------------ + + def WriteResponseNotModified(self) : + return self.WriteResponseError(304) + + # ------------------------------------------------------------------------ + + def WriteResponseBadRequest(self) : + return self.WriteResponseError(400) + + # ------------------------------------------------------------------------ + + def WriteResponseForbidden(self) : + return self.WriteResponseError(403) + + # ------------------------------------------------------------------------ + + def WriteResponseNotFound(self) : + if self._client._microWebSrv._notFoundUrl : + self.WriteResponseRedirect(self._client._microWebSrv._notFoundUrl) + else : + return self.WriteResponseError(404) + + # ------------------------------------------------------------------------ + + def WriteResponseMethodNotAllowed(self) : + return self.WriteResponseError(405) + + # ------------------------------------------------------------------------ + + def WriteResponseInternalServerError(self) : + return self.WriteResponseError(500) + + # ------------------------------------------------------------------------ + + def WriteResponseNotImplemented(self) : + return self.WriteResponseError(501) + + # ------------------------------------------------------------------------ + + def FlashMessage(self, messageText, messageStyle='') : + if 'MicroWebTemplate' in globals() : + MicroWebTemplate.MESSAGE_TEXT = messageText + MicroWebTemplate.MESSAGE_STYLE = messageStyle + + # ------------------------------------------------------------------------ + + _errCtnTmpl = """\ + + + Error + + +

%(code)d %(reason)s

+ %(message)s + + + """ + + # ------------------------------------------------------------------------ + + _execErrCtnTmpl = """\ + + + Page execution error + + +

%(module)s page execution error

+ %(message)s + + + """ + + # ------------------------------------------------------------------------ + + _responseCodes = { + 100: ('Continue', 'Request received, please continue'), + 101: ('Switching Protocols', + 'Switching to new protocol; obey Upgrade header'), + + 200: ('OK', 'Request fulfilled, document follows'), + 201: ('Created', 'Document created, URL follows'), + 202: ('Accepted', + 'Request accepted, processing continues off-line'), + 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), + 204: ('No Content', 'Request fulfilled, nothing follows'), + 205: ('Reset Content', 'Clear input form for further input.'), + 206: ('Partial Content', 'Partial content follows.'), + + 300: ('Multiple Choices', + 'Object has several resources -- see URI list'), + 301: ('Moved Permanently', 'Object moved permanently -- see URI list'), + 302: ('Found', 'Object moved temporarily -- see URI list'), + 303: ('See Other', 'Object moved -- see Method and URL list'), + 304: ('Not Modified', + 'Document has not changed since given time'), + 305: ('Use Proxy', + 'You must use proxy specified in Location to access this ' + 'resource.'), + 307: ('Temporary Redirect', + 'Object moved temporarily -- see URI list'), + + 400: ('Bad Request', + 'Bad request syntax or unsupported method'), + 401: ('Unauthorized', + 'No permission -- see authorization schemes'), + 402: ('Payment Required', + 'No payment -- see charging schemes'), + 403: ('Forbidden', + 'Request forbidden -- authorization will not help'), + 404: ('Not Found', 'Nothing matches the given URI'), + 405: ('Method Not Allowed', + 'Specified method is invalid for this resource.'), + 406: ('Not Acceptable', 'URI not available in preferred format.'), + 407: ('Proxy Authentication Required', 'You must authenticate with ' + 'this proxy before proceeding.'), + 408: ('Request Timeout', 'Request timed out; try again later.'), + 409: ('Conflict', 'Request conflict.'), + 410: ('Gone', + 'URI no longer exists and has been permanently removed.'), + 411: ('Length Required', 'Client must specify Content-Length.'), + 412: ('Precondition Failed', 'Precondition in headers is false.'), + 413: ('Request Entity Too Large', 'Entity is too large.'), + 414: ('Request-URI Too Long', 'URI is too long.'), + 415: ('Unsupported Media Type', 'Entity body in unsupported format.'), + 416: ('Requested Range Not Satisfiable', + 'Cannot satisfy request range.'), + 417: ('Expectation Failed', + 'Expect condition could not be satisfied.'), + + 500: ('Internal Server Error', 'Server got itself in trouble'), + 501: ('Not Implemented', + 'Server does not support this operation'), + 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'), + 503: ('Service Unavailable', + 'The server cannot process the request due to a high load'), + 504: ('Gateway Timeout', + 'The gateway server did not receive a timely response'), + 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'), + } + + # ============================================================================ + # ============================================================================ + # ============================================================================ + diff --git a/Software/pid.py b/Software/pid.py new file mode 100644 index 0000000..2b8f343 --- /dev/null +++ b/Software/pid.py @@ -0,0 +1,86 @@ +import gc + +class PID: + def __init__(self, Kp, Ki, Kd, Dt): + """ + PID绫荤殑鍒濆鍖栧苟浼犻掑繀瑕佺殑鍙傛暟 + :param Kp: 姣斾緥鍙傛暟 娴偣鏁 + :param Ki: 绉垎鍙傛暟 娴偣鏁 + :param Kd: 寰垎鍙傛暟 娴偣鏁 + :param Dt: PID璋冭妭鍛ㄦ湡 娴偣鏁帮紙s锛 + """ + self.Kp = Kp + self.Ki = Ki + self.Kd = Kd + self.Dt = Dt + self.previous_error = 0 + self.integral = 0 + + def set_pidparam(self, Kp, Ki, Kd, Dt): + """ + 鎺у埗杩囩▼涓璓ID鍙傛暟鐨勮瀹 + :param Kp: 姣斾緥鍙傛暟 娴偣鏁 + :param Ki: 绉垎鍙傛暟 娴偣鏁 + :param Kd: 寰垎鍙傛暟 娴偣鏁 + :param Dt: PID璋冭妭鍛ㄦ湡 娴偣鏁帮紙s锛 + :return: None + """ + self.Kp = Kp + self.Ki = Ki + self.Kd = Kd + self.Dt = Dt + + def clear_data(self): + """ + 娓呯┖鏁版嵁 + """ + self.previous_error = 0 + self.integral = 0 + + def get_output(self, target_value, now_value): + """ + 鑾峰彇灏嗚璋冭妭鐨勬帶鍒堕噺 + :param target_value: 鐩爣鍊 + :param now_value: 褰撳墠鐩戞祴鍒扮殑鍊 + :return: 璋冭妭閲 + """ + error = target_value - now_value + self.integral = self.integral + error * self.Dt + derivative = (error - self.previous_error) / self.Dt + output = self.Kp*error + self.Ki*self.integral + self.Kd*derivative + self.previous_error = error + gc.collect() + return output + + def __del__(self, ): + pass + + +class Auto_PID(PID): + pass + + +""" +This is demo +""" +if __name__ == "test": +#if __name__ == "__main__": + import gc + gc.collect() + from machine import Timer + + pid_contorller = PID(0.1, 0.1, 0.1, 0.01) + + tim = Timer(-1) + # mode: Timer.ONE_SHOT / Timer.PERIODIC + tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t: print(2)) + while True: + output_val = pid_contorller.get_output(100, 200) + + + + + + + + diff --git a/Software/ssd1306.py b/Software/ssd1306.py new file mode 100644 index 0000000..455636a --- /dev/null +++ b/Software/ssd1306.py @@ -0,0 +1,190 @@ +# MicroPython SSD1306 OLED driver, I2C and SPI interfaces +from micropython import const +import time +import framebuf +import sys + +currentBoard="" +if(sys.platform=="esp8266"): + currentBoard="esp8266" +elif(sys.platform=="esp32"): + currentBoard="esp32" +elif(sys.platform=="pyboard"): + currentBoard="pyboard" + import pyb +# register definitions +SET_CONTRAST = const(0x81) +SET_ENTIRE_ON = const(0xa4) +SET_NORM_INV = const(0xa6) +SET_DISP = const(0xae) +SET_MEM_ADDR = const(0x20) +SET_COL_ADDR = const(0x21) +SET_PAGE_ADDR = const(0x22) +SET_DISP_START_LINE = const(0x40) +SET_SEG_REMAP = const(0xa0) +SET_MUX_RATIO = const(0xa8) +SET_COM_OUT_DIR = const(0xc0) +SET_DISP_OFFSET = const(0xd3) +SET_COM_PIN_CFG = const(0xda) +SET_DISP_CLK_DIV = const(0xd5) +SET_PRECHARGE = const(0xd9) +SET_VCOM_DESEL = const(0xdb) +SET_CHARGE_PUMP = const(0x8d) +class SSD1306: + def __init__(self, width, height, external_vcc): + self.width = width + self.height = height + self.external_vcc = external_vcc + self.pages = self.height // 8 + self.buffer = bytearray(self.pages * self.width) + self.framebuf = framebuf.FrameBuffer(self.buffer, self.width, self.height, framebuf.MVLSB) + self.poweron() + self.init_display() + def init_display(self): + for cmd in ( + SET_DISP | 0x00, # off + # address setting + SET_MEM_ADDR, 0x00, # horizontal + # resolution and layout + SET_DISP_START_LINE | 0x00, + SET_SEG_REMAP | 0x01, # column addr 127 mapped to SEG0 + SET_MUX_RATIO, self.height - 1, + SET_COM_OUT_DIR | 0x08, # scan from COM[N] to COM0 + SET_DISP_OFFSET, 0x00, + SET_COM_PIN_CFG, 0x02 if self.height == 32 else 0x12, + # timing and driving scheme + SET_DISP_CLK_DIV, 0x80, + SET_PRECHARGE, 0x22 if self.external_vcc else 0xf1, + SET_VCOM_DESEL, 0x30, # 0.83*Vcc + # display + SET_CONTRAST, 0xff, # maximum + SET_ENTIRE_ON, # output follows RAM contents + SET_NORM_INV, # not inverted + # charge pump + SET_CHARGE_PUMP, 0x10 if self.external_vcc else 0x14, + SET_DISP | 0x01): # on + self.write_cmd(cmd) + self.fill(0) + self.show() + def poweroff(self): + self.write_cmd(SET_DISP | 0x00) + def contrast(self, contrast): + self.write_cmd(SET_CONTRAST) + self.write_cmd(contrast) + def invert(self, invert): + self.write_cmd(SET_NORM_INV | (invert & 1)) + def show(self): + x0 = 0 + x1 = self.width - 1 + if self.width == 64: + # displays with width of 64 pixels are shifted by 32 + x0 += 32 + x1 += 32 + self.write_cmd(SET_COL_ADDR) + self.write_cmd(x0) + self.write_cmd(x1) + self.write_cmd(SET_PAGE_ADDR) + self.write_cmd(0) + self.write_cmd(self.pages - 1) + self.write_data(self.buffer) + def fill(self, col): + self.framebuf.fill(col) + def pixel(self, x, y, col): + self.framebuf.pixel(x, y, col) + def scroll(self, dx, dy): + self.framebuf.scroll(dx, dy) + def text(self, string, x, y, col=1): + self.framebuf.text(string, x, y, col) + def hline(self, x, y, w, col): + self.framebuf.hline(x, y, w, col) + def vline(self, x, y, h, col): + self.framebuf.vline(x, y, h, col) + def line(self, x1, y1, x2, y2, col): + self.framebuf.line(x1, y1, x2, y2, col) + def rect(self, x, y, w, h, col): + self.framebuf.rect(x, y, w, h, col) + def fill_rect(self, x, y, w, h, col): + self.framebuf.fill_rect(x, y, w, h, col) + def blit(self, fbuf, x, y): + self.framebuf.blit(fbuf, x, y) + +class SSD1306_I2C(SSD1306): + def __init__(self, width, height, i2c, addr=0x3c, external_vcc=False): + self.i2c = i2c + self.addr = addr + self.temp = bytearray(2) + super().__init__(width, height, external_vcc) + def write_cmd(self, cmd): + self.temp[0] = 0x80 # Co=1, D/C#=0 + self.temp[1] = cmd + #IF SYS : + global currentBoard + if currentBoard=="esp8266" or currentBoard=="esp32": + self.i2c.writeto(self.addr, self.temp) + elif currentBoard=="pyboard": + self.i2c.send(self.temp,self.addr) + #ELSE: + + def write_data(self, buf): + self.temp[0] = self.addr << 1 + self.temp[1] = 0x40 # Co=0, D/C#=1 + global currentBoard + if currentBoard=="esp8266" or currentBoard=="esp32": + self.i2c.start() + self.i2c.write(self.temp) + self.i2c.write(buf) + self.i2c.stop() + elif currentBoard=="pyboard": + #self.i2c.send(self.temp,self.addr) + #self.i2c.send(buf,self.addr) + self.i2c.mem_write(buf,self.addr,0x40) + def poweron(self): + pass + +class SSD1306_SPI(SSD1306): + def __init__(self, width, height, spi, dc, res, cs, external_vcc=False): + self.rate = 10 * 1024 * 1024 + dc.init(dc.OUT, value=0) + res.init(res.OUT, value=0) + cs.init(cs.OUT, value=1) + self.spi = spi + self.dc = dc + self.res = res + self.cs = cs + super().__init__(width, height, external_vcc) + def write_cmd(self, cmd): + global currentBoard + if currentBoard=="esp8266" or currentBoard=="esp32": + self.spi.init(baudrate=self.rate, polarity=0, phase=0) + elif currentBoard=="pyboard": + self.spi.init(mode = pyb.SPI.MASTER,baudrate=self.rate, polarity=0, phase=0) + self.cs.high() + self.dc.low() + self.cs.low() + global currentBoard + if currentBoard=="esp8266" or currentBoard=="esp32": + self.spi.write(bytearray([cmd])) + elif currentBoard=="pyboard": + self.spi.send(bytearray([cmd])) + self.cs.high() + def write_data(self, buf): + global currentBoard + if currentBoard=="esp8266" or currentBoard=="esp32": + self.spi.init(baudrate=self.rate, polarity=0, phase=0) + elif currentBoard=="pyboard": + self.spi.init(mode = pyb.SPI.MASTER,baudrate=self.rate, polarity=0, phase=0) + self.cs.high() + self.dc.high() + self.cs.low() + global currentBoard + if currentBoard=="esp8266" or currentBoard=="esp32": + self.spi.write(buf) + elif currentBoard=="pyboard": + self.spi.send(buf) + self.cs.high() + def poweron(self): + self.res.high() + time.sleep_ms(1) + self.res.low() + time.sleep_ms(10) + self.res.high() \ No newline at end of file diff --git a/Software/ssd1306_esp.py b/Software/ssd1306_esp.py new file mode 100644 index 0000000..0c25c92 --- /dev/null +++ b/Software/ssd1306_esp.py @@ -0,0 +1,292 @@ +# MicroPython SSD1306 OLED driver, I2C and SPI interfaces +from micropython import const +import time +import framebuf +import sys + +# register definitions +SET_CONTRAST = const(0x81) +SET_ENTIRE_ON = const(0xa4) +SET_NORM_INV = const(0xa6) +SET_DISP = const(0xae) +SET_MEM_ADDR = const(0x20) +SET_COL_ADDR = const(0x21) +SET_PAGE_ADDR = const(0x22) +SET_DISP_START_LINE = const(0x40) +SET_SEG_REMAP = const(0xa0) +SET_MUX_RATIO = const(0xa8) +SET_COM_OUT_DIR = const(0xc0) +SET_DISP_OFFSET = const(0xd3) +SET_COM_PIN_CFG = const(0xda) +SET_DISP_CLK_DIV = const(0xd5) +SET_PRECHARGE = const(0xd9) +SET_VCOM_DESEL = const(0xdb) +SET_CHARGE_PUMP = const(0x8d) + +class SSD1306: + def __init__(self, width, height, external_vcc): + self.width = width + self.height = height + self.external_vcc = external_vcc + self.pages = self.height // 8 + self.buffer = bytearray(self.pages * self.width) + self.framebuf = framebuf.FrameBuffer(self.buffer, self.width, self.height, framebuf.MVLSB) + self.poweron() + self.init_display() + self.num_list = [b'\x00\xE0\x10\x08\x08\x10\xE0\x00\x00\x0F\x10\x20\x20\x10\x0F\x00', #0 + b'\x00\x00\x10\x10\xF8\x00\x00\x00\x00\x00\x20\x20\x3F\x20\x20\x00', + b'\x00\x70\x08\x08\x08\x08\xF0\x00\x00\x30\x28\x24\x22\x21\x30\x00', + b'\x00\x30\x08\x08\x08\x88\x70\x00\x00\x18\x20\x21\x21\x22\x1C\x00', + b'\x00\x00\x80\x40\x30\xF8\x00\x00\x00\x06\x05\x24\x24\x3F\x24\x24', + b'\x00\xF8\x88\x88\x88\x08\x08\x00\x00\x19\x20\x20\x20\x11\x0E\x00', + b'\x00\xE0\x10\x88\x88\x90\x00\x00\x00\x0F\x11\x20\x20\x20\x1F\x00', + b'\x00\x18\x08\x08\x88\x68\x18\x00\x00\x00\x00\x3E\x01\x00\x00\x00', + b'\x00\x70\x88\x08\x08\x88\x70\x00\x00\x1C\x22\x21\x21\x22\x1C\x00', + b'\x00\xF0\x08\x08\x08\x10\xE0\x00\x00\x01\x12\x22\x22\x11\x0F\x00', #9 + b'\x08\x18\x68\x80\x80\x68\x18\x08\x20\x30\x2C\x03\x03\x2C\x30\x20', #X + b'\x00\x00\x00\xF8\x00\x00\x00\x00\x00\x00\x00\x33\x00\x00\x00\x00' #! + ] + def init_display(self): + for cmd in ( + SET_DISP | 0x00, # off + # address setting + SET_MEM_ADDR, 0x00, # horizontal + # resolution and layout + SET_DISP_START_LINE | 0x00, + SET_SEG_REMAP | 0x01, # column addr 127 mapped to SEG0 + SET_MUX_RATIO, self.height - 1, + SET_COM_OUT_DIR | 0x08, # scan from COM[N] to COM0 + SET_DISP_OFFSET, 0x00, + SET_COM_PIN_CFG, 0x02 if self.height == 32 else 0x12, + # timing and driving scheme + SET_DISP_CLK_DIV, 0x80, + SET_PRECHARGE, 0x22 if self.external_vcc else 0xf1, + SET_VCOM_DESEL, 0x30, # 0.83*Vcc + # display + SET_CONTRAST, 0xff, # maximum + SET_ENTIRE_ON, # output follows RAM contents + SET_NORM_INV, # not inverted + # charge pump + SET_CHARGE_PUMP, 0x10 if self.external_vcc else 0x14, + SET_DISP | 0x01): # on + self.write_cmd(cmd) + self.fill(0) + self.show() + def poweroff(self): + self.write_cmd(SET_DISP | 0x00) + def contrast(self, contrast): # 璋冩暣浜害銆0鏈鏆楋紝255鏈浜 + self.write_cmd(SET_CONTRAST) + self.write_cmd(contrast) + def invert(self, invert): # 濂囨暟鏃跺弽鐩告樉绀猴紝鍋舵暟鏃舵甯告樉绀 + self.write_cmd(SET_NORM_INV | (invert & 1)) + + # 鏇存柊鏄剧ず鍐呭銆傚ぇ閮ㄥ垎鍑芥暟鍙槸鍐欏叆鏁版嵁鍒扮紦鍐插尯锛屽苟涓嶄細鐩存帴鏄剧ず鍒板睆骞曪紝闇瑕佽皟鐢╯how()鍚庢墠鑳芥樉绀哄嚭鏉ャ + def show(self): + x0 = 0 + x1 = self.width - 1 + if self.width == 64: + # displays with width of 64 pixels are shifted by 32 + x0 += 32 + x1 += 32 + self.write_cmd(SET_COL_ADDR) + self.write_cmd(x0) + self.write_cmd(x1) + self.write_cmd(SET_PAGE_ADDR) + self.write_cmd(0) + self.write_cmd(self.pages - 1) + self.write_data(self.buffer) + def fill(self, col): # n=0锛屾竻绌哄睆骞曪紝n澶т簬0锛屽~鍏呭睆骞 + self.framebuf.fill(col) + def pixel(self, x, y, col): # 鍦(x, y)澶勭敾鐐 + self.framebuf.pixel(x, y, col) + def scroll(self, dx, dy): # 婊氬睆 + self.framebuf.scroll(dx, dy) + def text(self, string, x, y, col=1): # 鍦(x, y)澶勬樉绀哄瓧绗︿覆锛屾敞鎰弔ext()鍑芥暟鍐呯疆鐨勫瓧浣撴槸8x8鐨勶紝鏆傛椂涓嶈兘鏇挎崲 + self.framebuf.text(string, x, y, col) + + def text_num(self, string, x, y, col=1): # 鍦(x, y)澶勬樉绀哄瓧绗︿覆锛屾敞鎰弔ext()鍑芥暟鍐呯疆鐨勫瓧浣撴槸8x16鐨勶紝鏆傛椂涓嶈兘鏇挎崲 + x0 = x%8 + x1 = x + y0 = y%8 # 34 2 + y1 = y//8*128 # 34 4 + index = 0 + + for s in string: + if s=='X': + index = 10 + elif s=='!': + index = 11 + else: + index = int(s) + + start = y1+x1 + for num in range(8): + self.buffer[start+num] = (self.buffer[start+num]<<(8-y0)>>(8-y0)) | (self.num_list[index][num]<>(8-y0)) | (self.num_list[index][num+8]<=8*128: + continue + for num in range(8): + self.buffer[start+num] = (self.num_list[index][num+8]>>(8-y0)) | (self.buffer[start+num]<>(8-y0)) | (img[num]<>(8-y0)) | (img[num+16]<=8*128: + return + for num in range(16): + self.buffer[start+num] = (img[num+16]>>(8-y0)) | (self.buffer[start+num]<> 16) & 0xff, + (color >> 8) & 0xff, + color & 0xff + ]); + } + + return out; +})(); + +/** + * Options + */ + +Terminal.defaults = { + colors: Terminal.colors, + convertEol: false, + termName: 'xterm', + geometry: [80, 24], + cursorBlink: true, + visualBell: false, + popOnBell: false, + scrollback: 1000, + screenKeys: false, + debug: false, + useStyle: false + // programFeatures: false, + // focusKeys: false, +}; + +Terminal.options = {}; + +each(keys(Terminal.defaults), function(key) { + Terminal[key] = Terminal.defaults[key]; + Terminal.options[key] = Terminal.defaults[key]; +}); + +/** + * Focused Terminal + */ + +Terminal.focus = null; + +Terminal.prototype.focus = function() { + if (Terminal.focus === this) return; + + if (Terminal.focus) { + Terminal.focus.blur(); + } + + if (this.sendFocus) this.send('\x1b[I'); + this.showCursor(); + + // try { + // this.element.focus(); + // } catch (e) { + // ; + // } + + // this.emit('focus'); + + Terminal.focus = this; +}; + +Terminal.prototype.blur = function() { + if (Terminal.focus !== this) return; + + this.cursorState = 0; + this.refresh(this.y, this.y); + if (this.sendFocus) this.send('\x1b[O'); + + // try { + // this.element.blur(); + // } catch (e) { + // ; + // } + + // this.emit('blur'); + + Terminal.focus = null; +}; + +/** + * Initialize global behavior + */ + +Terminal.prototype.initGlobal = function() { + var document = this.document; + + Terminal._boundDocs = Terminal._boundDocs || []; + if (~indexOf(Terminal._boundDocs, document)) { + return; + } + Terminal._boundDocs.push(document); + + Terminal.bindPaste(document); + + Terminal.bindKeys(document); + + Terminal.bindCopy(document); + + if (this.isMobile) { + this.fixMobile(document); + } + + if (this.useStyle) { + Terminal.insertStyle(document, this.colors[256], this.colors[257]); + } +}; + +/** + * Bind to paste event + */ + +Terminal.bindPaste = function(document) { + // This seems to work well for ctrl-V and middle-click, + // even without the contentEditable workaround. + var window = document.defaultView; + on(window, 'paste', function(ev) { + var term = Terminal.focus; + if (!term) return; + if (ev.clipboardData) { + term.send(ev.clipboardData.getData('text/plain')); + } else if (term.context.clipboardData) { + term.send(term.context.clipboardData.getData('Text')); + } + // Not necessary. Do it anyway for good measure. + term.element.contentEditable = 'inherit'; + return cancel(ev); + }); +}; + +/** + * Global Events for key handling + */ + +Terminal.bindKeys = function(document) { + // We should only need to check `target === body` below, + // but we can check everything for good measure. + on(document, 'keydown', function(ev) { + if (!Terminal.focus) return; + var target = ev.target || ev.srcElement; + if (!target) return; + if (target === Terminal.focus.element + || target === Terminal.focus.context + || target === Terminal.focus.document + || target === Terminal.focus.body + || target === Terminal._textarea + || target === Terminal.focus.parent) { + return Terminal.focus.keyDown(ev); + } + }, true); + + on(document, 'keypress', function(ev) { + if (!Terminal.focus) return; + var target = ev.target || ev.srcElement; + if (!target) return; + if (ev.ctrlKey && ev.key === 'v') { + // If we got here with Ctrl+V, then we know it's us who enabled it + // to bubble to be handled by browser as Paste, so let this happen. + return; + } + if (target === Terminal.focus.element + || target === Terminal.focus.context + || target === Terminal.focus.document + || target === Terminal.focus.body + || target === Terminal._textarea + || target === Terminal.focus.parent) { + // In case user popped up context menu, widget may be stuck in + // "contentEditable" state (as a workaround for Firefox braindeadness) + // with visual artifacts like browser's cursur. Disable it now. + Terminal.focus.element.contentEditable = 'inherit'; + return Terminal.focus.keyPress(ev); + } + }, true); + + // If we click somewhere other than a + // terminal, unfocus the terminal. + on(document, 'mousedown', function(ev) { + if (!Terminal.focus) return; + + var el = ev.target || ev.srcElement; + if (!el) return; + + do { + if (el === Terminal.focus.element) return; + } while (el = el.parentNode); + + Terminal.focus.blur(); + }); +}; + +/** + * Copy Selection w/ Ctrl-C (Select Mode) + */ + +Terminal.bindCopy = function(document) { + var window = document.defaultView; + + // if (!('onbeforecopy' in document)) { + // // Copies to *only* the clipboard. + // on(window, 'copy', function fn(ev) { + // var term = Terminal.focus; + // if (!term) return; + // if (!term._selected) return; + // var text = term.grabText( + // term._selected.x1, term._selected.x2, + // term._selected.y1, term._selected.y2); + // term.emit('copy', text); + // ev.clipboardData.setData('text/plain', text); + // }); + // return; + // } + + // Copies to primary selection *and* clipboard. + // NOTE: This may work better on capture phase, + // or using the `beforecopy` event. + on(window, 'copy', function(ev) { + var term = Terminal.focus; + if (!term) return; + if (!term._selected) return; + var textarea = term.getCopyTextarea(); + var text = term.grabText( + term._selected.x1, term._selected.x2, + term._selected.y1, term._selected.y2); + term.emit('copy', text); + textarea.focus(); + textarea.textContent = text; + textarea.value = text; + textarea.setSelectionRange(0, text.length); + setTimeout(function() { + term.element.focus(); + term.focus(); + }, 1); + }); +}; + +/** + * Fix Mobile + */ + +Terminal.prototype.fixMobile = function(document) { + var self = this; + + var textarea = document.createElement('textarea'); + textarea.style.position = 'absolute'; + textarea.style.left = '-32000px'; + textarea.style.top = '-32000px'; + textarea.style.width = '0px'; + textarea.style.height = '0px'; + textarea.style.opacity = '0'; + textarea.style.backgroundColor = 'transparent'; + textarea.style.borderStyle = 'none'; + textarea.style.outlineStyle = 'none'; + textarea.autocapitalize = 'none'; + textarea.autocorrect = 'off'; + + document.getElementsByTagName('body')[0].appendChild(textarea); + + Terminal._textarea = textarea; + + setTimeout(function() { + textarea.focus(); + }, 1000); + + if (this.isAndroid) { + on(textarea, 'change', function() { + var value = textarea.textContent || textarea.value; + textarea.value = ''; + textarea.textContent = ''; + self.send(value + '\r'); + }); + } +}; + +/** + * Insert a default style + */ + +Terminal.insertStyle = function(document, bg, fg) { + var style = document.getElementById('term-style'); + if (style) return; + + var head = document.getElementsByTagName('head')[0]; + if (!head) return; + + var style = document.createElement('style'); + style.id = 'term-style'; + + // textContent doesn't work well with IE for + + + + + +
+
+ + +
+
+
+
+ +
+ +
+ Send a file + +
+ +
+ +
+ Get a file + + +
+ +
(file operation status)
+ +
+ +
+Terminal widget should be focused (text cursor visible) to accept input. Click on it if not.
+To paste, press Ctrl+A, then Ctrl+V + + + + + diff --git a/webrepl-master/webrepl_cli.py b/webrepl-master/webrepl_cli.py new file mode 100644 index 0000000..55a9eea --- /dev/null +++ b/webrepl-master/webrepl_cli.py @@ -0,0 +1,258 @@ +#!/usr/bin/env python +from __future__ import print_function +import sys +import os +import struct +try: + import usocket as socket +except ImportError: + import socket +import websocket_helper + +# Define to 1 to use builtin "uwebsocket" module of MicroPython +USE_BUILTIN_UWEBSOCKET = 0 +# Treat this remote directory as a root for file transfers +SANDBOX = "" +#SANDBOX = "/tmp/webrepl/" +DEBUG = 0 + +WEBREPL_REQ_S = "<2sBBQLH64s" +WEBREPL_PUT_FILE = 1 +WEBREPL_GET_FILE = 2 +WEBREPL_GET_VER = 3 + + +def debugmsg(msg): + if DEBUG: + print(msg) + + +if USE_BUILTIN_UWEBSOCKET: + from uwebsocket import websocket +else: + class websocket: + + def __init__(self, s): + self.s = s + self.buf = b"" + + def write(self, data): + l = len(data) + if l < 126: + # TODO: hardcoded "binary" type + hdr = struct.pack(">BB", 0x82, l) + else: + hdr = struct.pack(">BBH", 0x82, 126, l) + self.s.send(hdr) + self.s.send(data) + + def recvexactly(self, sz): + res = b"" + while sz: + data = self.s.recv(sz) + if not data: + break + res += data + sz -= len(data) + return res + + def read(self, size, text_ok=False): + if not self.buf: + while True: + hdr = self.recvexactly(2) + assert len(hdr) == 2 + fl, sz = struct.unpack(">BB", hdr) + if sz == 126: + hdr = self.recvexactly(2) + assert len(hdr) == 2 + (sz,) = struct.unpack(">H", hdr) + if fl == 0x82: + break + if text_ok and fl == 0x81: + break + debugmsg("Got unexpected websocket record of type %x, skipping it" % fl) + while sz: + skip = self.s.recv(sz) + debugmsg("Skip data: %s" % skip) + sz -= len(skip) + data = self.recvexactly(sz) + assert len(data) == sz + self.buf = data + + d = self.buf[:size] + self.buf = self.buf[size:] + assert len(d) == size, len(d) + return d + + def ioctl(self, req, val): + assert req == 9 and val == 2 + + +def login(ws, passwd): + while True: + c = ws.read(1, text_ok=True) + if c == b":": + assert ws.read(1, text_ok=True) == b" " + break + ws.write(passwd.encode("utf-8") + b"\r") + +def read_resp(ws): + data = ws.read(4) + sig, code = struct.unpack("<2sH", data) + assert sig == b"WB" + return code + + +def send_req(ws, op, sz=0, fname=b""): + rec = struct.pack(WEBREPL_REQ_S, b"WA", op, 0, 0, sz, len(fname), fname) + debugmsg("%r %d" % (rec, len(rec))) + ws.write(rec) + + +def get_ver(ws): + send_req(ws, WEBREPL_GET_VER) + d = ws.read(3) + d = struct.unpack(": - Copy remote file to local file") + print(" [-p password] : - Copy local file to remote file") + print("Examples:") + print(" %s script.py 192.168.4.1:/another_name.py" % exename) + print(" %s script.py 192.168.4.1:/app/" % exename) + print(" %s -p password 192.168.4.1:/app/script.py ." % exename) + sys.exit(rc) + +def error(msg): + print(msg) + sys.exit(1) + +def parse_remote(remote): + host, fname = remote.rsplit(":", 1) + if fname == "": + fname = "/" + port = 8266 + if ":" in host: + host, port = host.split(":") + port = int(port) + return (host, port, fname) + + +def main(): + if len(sys.argv) not in (3, 5): + help(1) + + passwd = None + for i in range(len(sys.argv)): + if sys.argv[i] == '-p': + sys.argv.pop(i) + passwd = sys.argv.pop(i) + break + + if not passwd: + import getpass + passwd = getpass.getpass() + + if ":" in sys.argv[1] and ":" in sys.argv[2]: + error("Operations on 2 remote files are not supported") + if ":" not in sys.argv[1] and ":" not in sys.argv[2]: + error("One remote file is required") + + if ":" in sys.argv[1]: + op = "get" + host, port, src_file = parse_remote(sys.argv[1]) + dst_file = sys.argv[2] + if os.path.isdir(dst_file): + basename = src_file.rsplit("/", 1)[-1] + dst_file += "/" + basename + else: + op = "put" + host, port, dst_file = parse_remote(sys.argv[2]) + src_file = sys.argv[1] + if dst_file[-1] == "/": + basename = src_file.rsplit("/", 1)[-1] + dst_file += basename + + if True: + print("op:%s, host:%s, port:%d, passwd:%s." % (op, host, port, passwd)) + print(src_file, "->", dst_file) + + s = socket.socket() + + ai = socket.getaddrinfo(host, port) + addr = ai[0][4] + + s.connect(addr) + #s = s.makefile("rwb") + websocket_helper.client_handshake(s) + + ws = websocket(s) + + login(ws, passwd) + print("Remote WebREPL version:", get_ver(ws)) + + # Set websocket to send data marked as "binary" + ws.ioctl(9, 2) + + if op == "get": + get_file(ws, dst_file, src_file) + elif op == "put": + put_file(ws, src_file, dst_file) + + s.close() + + +if __name__ == "__main__": + main() diff --git a/webrepl-master/websocket_helper.py b/webrepl-master/websocket_helper.py new file mode 100644 index 0000000..22ac285 --- /dev/null +++ b/webrepl-master/websocket_helper.py @@ -0,0 +1,75 @@ +import sys +try: + import ubinascii as binascii +except: + import binascii +try: + import uhashlib as hashlib +except: + import hashlib + +DEBUG = 0 + +def server_handshake(sock): + clr = sock.makefile("rwb", 0) + l = clr.readline() + #sys.stdout.write(repr(l)) + + webkey = None + + while 1: + l = clr.readline() + if not l: + raise OSError("EOF in headers") + if l == b"\r\n": + break + # sys.stdout.write(l) + h, v = [x.strip() for x in l.split(b":", 1)] + if DEBUG: + print((h, v)) + if h == b'Sec-WebSocket-Key': + webkey = v + + if not webkey: + raise OSError("Not a websocket request") + + if DEBUG: + print("Sec-WebSocket-Key:", webkey, len(webkey)) + + respkey = webkey + b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11" + respkey = hashlib.sha1(respkey).digest() + respkey = binascii.b2a_base64(respkey)[:-1] + + resp = b"""\ +HTTP/1.1 101 Switching Protocols\r +Upgrade: websocket\r +Connection: Upgrade\r +Sec-WebSocket-Accept: %s\r +\r +""" % respkey + + if DEBUG: + print(resp) + sock.send(resp) + + +# Very simplified client handshake, works for MicroPython's +# websocket server implementation, but probably not for other +# servers. +def client_handshake(sock): + cl = sock.makefile("rwb", 0) + cl.write(b"""\ +GET / HTTP/1.1\r +Host: echo.websocket.org\r +Connection: Upgrade\r +Upgrade: websocket\r +Sec-WebSocket-Key: foo\r +\r +""") + l = cl.readline() +# print(l) + while 1: + l = cl.readline() + if l == b"\r\n": + break +# sys.stdout.write(l)