Skip to content

Commit

Permalink
Fixing shuffled image
Browse files Browse the repository at this point in the history
  • Loading branch information
F4310 committed Sep 22, 2024
1 parent b089690 commit e32a369
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions chipper/pkg/wirepod/sdkapp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,6 @@ func SdkapiHandler(w http.ResponseWriter, r *http.Request) {

defer imgPath.Close()

solidFaceBytes := make([]byte, 17664*10) // 17664 pixels, 3 bytes por pixel
for i := 0; i < len(solidFaceBytes); i += 3 {
solidFaceBytes[i] = 255 // R
solidFaceBytes[i+1] = 0 // G
solidFaceBytes[i+2] = 0 // B
}

img, _, err := image.Decode(imgPath)
if err != nil {
http.Error(w, "Error reading image: "+err.Error(), http.StatusInternalServerError)
Expand Down Expand Up @@ -185,7 +178,7 @@ func SdkapiHandler(w http.ResponseWriter, r *http.Request) {
}

// Reads the image and handles possible errors
//faceBytes, err := rgbToBytes(rgbValues)
faceBytes, err := rgbToBytes(rgbValues)
if err != nil {
http.Error(w, "Error reading image: "+err.Error(), http.StatusInternalServerError)
return
Expand All @@ -199,7 +192,7 @@ func SdkapiHandler(w http.ResponseWriter, r *http.Request) {

// call DisplayFaceImageRGB e handle error
resp, err := robot.Conn.DisplayFaceImageRGB(ctx, &vectorpb.DisplayFaceImageRGBRequest{
FaceData: solidFaceBytes,
FaceData: faceBytes,
DurationMs: uint32(duration),
InterruptRunning: true,
})
Expand Down

0 comments on commit e32a369

Please sign in to comment.